PDA

View Full Version : OpenGL gives blank window



nagamani
08-10-2017, 12:13 AM
hi all.. iam new to Open GL and is trying to print 2 dots on the window.but just a blank window is displaying all the time.. please help me with this thank u

this is the code iam trying


#include<gl/gl.h>
#include<gl/glu.h>
#include<gl/glut.h>
void myinit()
{
glPointSize(10);
glClearColor(1.0,1.0,0.0,1.0);
glColor3f(1.0,0.0,0.0);
}
void display()
{
glBegin(GL_POINTS);
glVertex2i(10,20);
glVertex2i(30,40);
glEnd();
glFlush();
}
int main(int argc, char** argv) {
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB);
glutInitWindowSize(640,480);
glutInitWindowPosition(100,12);
glutCreateWindow("Example");
glutDisplayFunc(display);
myinit();
glutMainLoop();
return 0;
}