Creating a Window with GLUT
#ifdef WIN32
#include <windows.h>
#endif
#include <glut.h>
void Initialize(void);
void Display(void);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
int argc;
char * argv[] = {"dummy",0};
argc = 1;
glutInit(&argc, (char **)&argv[0]);
glutInitDisplayMode(GLUT_RGBA|GLUT_DOUBLE);
glutInitWindowSize(640, 480);
glutInitWindowPosition(-1, -1); // Let window to determine the startup position
glutCreateWindow("Creating a window with GLUT");
Initialize();
glutDisplayFunc(Display);
glutMainLoop();
return 0;
}
void Initialize(void)
{
glClearColor(0.5f, 0.5f, 0.5f, 0.0f);
glShadeModel(GL_FLAT);
}
void Display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glutSwapBuffers();
}
: : go back : :