I'm trying to create a triangle with OpenGL but I see nothing but a white board on my screen.
Here's my code:
#include <GL/glut.h>
extern float vertices[3][3] =
{
{ -0.5f, -0.5f, 0.0f },
{ 0.5f, -0.5f, 0.0f },
{ 0.0f, 0.5f, 0.0f }
};
void display()
{
glClearColor(0, 0, 0, 1);
glBegin(GL_TRIANGLES);
glColor3fv(1, 0, 0);
glVertex3fv(vertices[0]);
glVertex3fv(vertices[1]);
glVertex3fv(vertices[2]);
glEnd();
glFlush();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE);
glutInitWindowSize(1000, 1000);
glutInitWindowPosition(0, 0);
glutCreateWindow("Hello Gult");
glutDisplayFunc(display);
glEnable(GL_DEPTH_TEST);
glutMainLoop();
return 0;
}
What could it be and how can I solve this?