glColor3f Setting colour
Posted
by
Aaron
on Game Development
See other posts from Game Development
or by Aaron
Published on 2012-03-25T02:52:17Z
Indexed on
2012/03/25
5:40 UTC
Read the original article
Hit count: 327
This draws a white vertical line from 640 to 768 at x512:
glDisable(GL_TEXTURE_2D);
glBegin(GL_LINES);
glColor3f((double)R/255,(double)G/255,(double)B/255);
glVertex3f(SX, -SPosY, 0); // origin of the line
glVertex3f(SX, -EPosY, 0); // ending point of the line
glEnd();
glEnable(GL_TEXTURE_2D);
This works, but after having a problem where it wouldn't draw it white (Or to any colour passed) I discovered that disabling GL_TEXTURE_2D Before drawing the line, and the re-enabling it afterwards for other things, fixed it. I want to know, is this a normal step a programmer might take? Or is it highly inefficient? I don't want to be causing any slow downs due to a mistake =)
Thanks
© Game Development or respective owner