hi,
Im having a very strange problem with glut.
I’ve been using it for the past year to do a lot of programming…but i come back after a break…and nothing seems to work…my simple program for drawing a triangle won’t even display. I have no idea what the problem is.
It creates a simple window, i clear the screen, i set a diff. color for drawing…and nothing! plz help (im using the correct libraries for compiling)
Here’s my code:
#include<GL/glut.h>
void init(void)
{
glClearColor(0.0,0.0,0.0,0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0,1.0,-1.0,1.0,-1.0,1.0);
}
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(1.0, 0.2, 0.3);
glVertex3f(0.33, 0.33, 0);
glVertex3f(0.8, 0.5, 0);
glVertex3f(0.9, 0.3, 0);
glEnd();
//glutSwapBuffers();
}
int main(int argc, char** argv){
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGBA | GLUT_SINGLE | GLUT_DEPTH );
glutInitWindowPosition(0,0);
glutInitWindowSize(300,300);
glutCreateWindow(argv[0]);
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
-Thanks