In the following code it doesn’t matter to the background color I am drawing, whether glClear comes first or glClearColor comes first. I don’t understand that: I thought glClear would clear the color buffers so at least in the example if I had glClearColor called first then glClear, the screen should be changed since the color information is cleared:
#include <gl/freeglut.h>
#include <math.h>
void keyboard(unsigned char key, int x, int y)
{
switch ( key )
case 27:
exit( 0 );
}
void render()
{
glClearColor(1.0, 1.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT); // should celar the color from glClearColor right?
glBegin( GL_LINES);
glVertex3d( 0, 0, 0);
glVertex3d( 0, 0, 0);
glEnd();
glutSwapBuffers() ;
}
int main( int argc, char** argv )
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowPosition(0,0);
glutInitWindowSize(1920,1080);
glutCreateWindow("Lines freeGLUT x64 Window");
glutFullScreen();
glutDisplayFunc( render );
glutKeyboardFunc(keyboard);
glutMainLoop();
}
I’m sure this is a major “newbism”. Thanks in advance.