drawing lines

For a class assignment I have to construct a wireframe cube (using lines, not faces or cube’s…) and can’t seem to find the syntax for defining lines. For a triangle I would simply use

glBegin(GL_TRIANGLES);
        glVertex3f(
....

Is there some sort of glBegin(GL_LINES) command that lets you specify the x,y,z coordinate of the starting coordinate and ending coordinate?

Thanks in advance!
-Dogcow “moof!”
Visit The Underground

[This message has been edited by Dogcow (edited 09-27-2002).]

glBegin(GL_LINES) as you mentioned.

You just about had it…

glBegin(GL_LINES);

glVertex3f( x1, y1, z1); // start of line.
glVertex3f( x2, y2, z2); // end of line.

glEnd();

Originally posted by Dogcow:
[b]For a class assignment I have to construct a wireframe cube (using lines, not faces or cube’s…) and can’t seem to find the syntax for defining lines. For a triangle I would simply use

[quote]

glBegin(GL_TRIANGLES);
        glVertex3f(
....

Is there some sort of glBegin(GL_LINES) command that lets you specify the x,y,z coordinate of the starting coordinate and ending coordinate?

Thanks in advance!
-Dogcow “moof!”
Visit The Underground

[This message has been edited by Dogcow (edited 09-27-2002).][/b][/QUOTE]

I’ve notice that when you draw line and start move away, the length of the line is getting shorter, but the width remains unchanged!!!How can i avvoid this, and draw line that gets tighter when i move the camera away?

Sounds like you are using perspective view, it renders things like a real life view.
Say you take a yard(meter) stick, as the stick moves away from you it will appear to get smaller. But the size of the stick has not change, only the distance.

What do you mean by tigher?

If you don’t want to line to change size as you move away, change to ortho view.
Object size does not change as it moves away from the camera.

Originally posted by Mreal:
I’ve notice that when you draw line and start move away, the length of the line is getting shorter, but the width remains unchanged!!!How can i avvoid this, and draw line that gets tighter when i move the camera away?

I think what he means is he wants the line to get thinner as it get farther away. OpenGL doesn’t change the thickness of lines or points based on distance. There is an extension that does this for points, but it doesn’t seem to be widely supported. I guess you could make “lines” get thinner as they get farther away by drawing them as thin rectangular prisms instead.