   How to draw (pseudo) infinite line?
  Hi all...I'm fairly new to opengl programming, but i think im already comfortable with the API. I've learned how to draw primitives, manipulating the model-view matrix, the matrix stack, and all the basic stuff. Now to ease my further learning. I need to draw some sort of axises to orient my self in the 3d scene. Please advise me on how to draw an (pseudo) infinite line/plane in OpenGL.I imagine drawing pass the viewing volume boundary, but it sure will only works if the observer is standing still and not move around. Thanks b4.   
  Use glBegin(GL_LINES) to draw some lines from the origin to wherever you want them (for instance, make it as long as the far plane). There's no magic involved. Observer moving around doesn't matter (Camera is set up by applying a transformation to the ModelView matrix before drawing anything else). ;Quote:Original post by lightbringerUse glBegin(GL_LINES) to draw some lines from the origin to wherever you want them (for instance, make it as long as the far plane). There's no magic involved. Observer moving around doesn't matter (Camera is set up by applying a transformation to the ModelView matrix before drawing anything else).Now there's the problem. How long is long enough? If the line spans all the way pass the far plane, i have no problem. But what if the far plane moved (as the result of camera moving) pass the end of the line? ;  I see what you mean. Actually, I had the same problem in Solariad except I was drawing a 2D grid along the xz plane. What I did was just make it really big (close objects were a couple of hundred units long and I put the plane out to 50,000 units, with lines spaced about 500 or 1000 units apart), but what happens is that, unless you enable fog, the lines on the horizon bunch up and the result is a bright patch. However, you only have three lines, so it shouldn't be a big problem. Just make them as long as your entire scene is likely to be, and if you ever run into it not being long enough, just make it longer. You start losing precision in your floats as you move far away from the origin, so your entire scene is not actually infinite (unless you're okay with objects randomly jumping around).   ;Quote:You start losing precision in your floats as you move far away from the origin, so your entire scene is not actually infinite.gee... i didn't know this till you said it. Ok, for now I will stick to the 'pseudo-infinite' solution. Spans the line from origin to hmm... lets say MAX_FLOAT and see what I'll end up with :)I was actually trying to mimic those CAD software where user can start drawing almost everywhere in the scene, even if at the beginning they're dropped at the origin.Thanks.   ;Quote:Original post by barkahgee... i didn't know this till you said it.Not sure if you meant that sarcastically, but if you didn't, then you might find this article interesting.;Oh no. Honestly no...Please apologize for the tone. English is not my first language.I just wonder. If what you say is true then there should be some 'magic' to keep precision in those engineering apps. But this is not my main concern right now. I'm just beginning to learn opengl and simply need to orient my self in the scene.Again, please apologize.   ;  I think those CAD programs don't generally need to deal with this... we're talking about the size of the Earth here, you are not very likely to use a CAD program to model the Earth, house by house.   ;Yeah, I realize that after reading the article. Clearly scale is not my issue right now.Now how about some procedural approach:- Have a plane (rect or polygon) act as the 'ground' i.e. drawn at y=0.- Move, shape and orient this plane along with the camera movement (in x-z plane only). Size it so that its wide enough to cover the bottom of viewing volume.- If the way this plane is being oriented makes it's boundary intersects with one of the axis lines (at two unique points), draw the lines on the plane (from the first point to the second).By doing so, viewers will only see the axis line if the axis line crosses the viewing volume. Trying it now... Advise for any potential issues.   ;  You can also experiment with w coordinate to draw "pseudo" infinite rays (they will be clipped to the view frustum anyway). for example, you could draw positive side of the X axis this way:glBegin(GL_LINES);glVertex4f(0.0f,0.0f,0.0f,1.0f);glVertex4f(1.0f,0.0f,0.0f,0.0f);//the fourth (w) component is zero!glEnd();