Member Avatar for ArashVenus

I've tried lots of times to get this to work but , no luck .
the problem is this program shows white screen , and It doesn't display the polygon .

Here's the code , take a look :

/*Headers*/
#include <GL/glut.h>
/*End of headers*/


/* Check Compiler*/
#ifdef __FLAT__
#include <Windows.h>
#endif 
/*End of Check*/


/*Preloaded  Functions*/
void myInit(void)
{
    glClearColor(1.0, 1.0, 1.0, 0.0);
    glShadeModel(GL_FLAT);
}


void myDisplay(void)
{
    glClear(GL_COLOR_BUFFER_BIT);
    glColor3f(1.0, 0.0, 0.0);
    glBegin(GL_POLYGON);
        glVertex2f(0.90 , 0.50);
        glVertex2f(0.50 , 0.90);
        glVertex2f(0.10 , 0.50);
        glVertex2f(0.50 , 0.10);
    glEnd();
}
/*End of preloaded functions*/


int main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
    glutInitWindowSize(800, 600);
    glutInitWindowPosition(100, 100);
    glutCreateWindow("Window Title -- Tamrin");
    myInit();
    glutDisplayFunc(myDisplay);
    glutMainLoop();
    return 0;
}
Member Avatar for ArashVenus

Well the problem was a bit too simple
I forgot swapping buffers ,
the Display function must have glutSwapBuffers(); on Its last line ;

Problem solved .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.