uh yeah...a line..i know.....

I have created a lot of openGL programs, yet for some reason i can not get a line to be drawn. just a line on the screen. nothing else in the window. It just does not want to work. If anyone has an example of a line(hates asking this…) could u plz post it.

thanks…

after a LOT of research, design, thinking, debugging:

glBegin(GL_LINES);
glVertex2f(0.0, 0.0);
glVertex2f(1.0, 1.0);
glEnd();

lines are also affected by any texturing/lighting/blending/whatever setup you’ve done. So, if you have lights on, then don’t forget to give the line some normals (or disable lighting), or give the line texture coordinates, and so on.

cheers.
John

It’s also affected by the modelview matrix, and clipped by the view frustum. Make sure you are drawing the line inside the view frustum. Otherwise it will not be drawn.

If it still doesn’t work, post some code.

Sorry people like 3 seconds after that post i saw what i was doing wrong…just a stupid mistake…Have to give the line some color…hehe…

yeah anyways…i was just frustrated and it was 4am in the morning, so i posted…sorry to waste everyones time while making myself look a bit goofy.

ha. i’m sure we’ve all done something silly like that before. =) 'especially at 4am in the morning.

small aside story:

one guy in my honours year was marking java assignments from first years. he only realised----after marking 50 assignments—that his classpath (or somesuch) was pointing to the example answer. he marked the same assignment fifty times before something clicked =)

cheers,
John

Sometimes the best solution is to get some sleep and try again in the morning with a clear head and a fresh perspective. Unfortunately, for uni students (and I know a lot of us are) that is easier said than done when an assignment is due in!