PDA

View Full Version : uh yeah...a line..i know.....



unleashed
05-06-2001, 03:58 PM
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...

john
05-06-2001, 04:56 PM
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

Bob
05-07-2001, 03:08 AM
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.

unleashed
05-09-2001, 11:54 PM
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.

john
05-10-2001, 02:53 AM
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

ffish
05-10-2001, 03:06 AM
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!