Reputation: 67
#include <stdio.h>
#include<stdlib.h>
#include<windows.h>
#include<GL/glut.h>
void display (void)
{
glClearColor(1.f, 0.f, 0.f, 1.f);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE);
glutInitWindowSize(500,500);
glutInitWindowPosition(100,100);
glutCreateWindow("Colorcube Viewer");
glutDisplayFunc(display);
glEnable(GL_DEPTH_TEST);
glutMainLoop();
return 0;
}
i am not able to figure out whats the problem with this code ?
it does not give me a red window.
Upvotes: 0
Views: 73
Reputation: 152
You need to call glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
after setting the clear color (because you have depth test enabled, make sure that you're clearing both the color buffer AND the depth buffer
Upvotes: 3