OpenGL Development on Windows XP Microsoft Visual Studio 2008

Needed an OpenGL development environment for my Computer Graphics class. These are my notes on how to prepare a clean install of Windows XP for doing OpenGL development using Microsoft Visual Studio Express C++ Edition.

1. Installed Visual Studio Express 2008 C++ Edition.
2. Verified that video driver had installed opengl32.dll in %WinDir%\System.
3. Downloaded GLUT zip file (dll, lib and header files) from http://www.xmission.com/~nate/glut.html.
4. Copied glut32.dll to %WinDir%\System.
5. Copied glut32.lib to $(MSDevDir)\..\..\VC98\lib (C:\Program Files\Microsoft Visual Studio 9.0\VC\lib).
6. Copied glut.h to $(MSDevDir)\..\..\VC98\include\GL.
7. Downloaded glext.h, glxext.h, and wglext.h from http://www.opengl.org/registry.
8. Copied glext.h, glxext.h, and wglext.h into C:\Program Files\Microsoft Visual Studio 9.0\VC\include\GL\.
9. Created new Visual C++ Win32 Console Application (unchecked Precompiled headers).
a. Delete all the generated files.
10. Added HelloOpenGL sample .c file and compile.

#include <windows.h>
#include <GL/gl.h>
#include <GL/glext.h>
#include <GL/glut.h>
#include <stdio.h>
#include <windows.h>#include <GL/gl.h>#include <GL/glext.h>#include <GL/glut.h>
#include <stdio.h>
void drawPolygons() {
glBegin(GL_TRIANGLES);
glColor3f(1.0, 0.0, 0.0);
glVertex2f(1.0, 0.0);
glVertex2f(1.0, 1.0);
glVertex2f(0.0, 1.0);
glEnd();
}
void display(void) {
glClear(GL_COLOR_BUFFER_BIT);
drawPolygons();
glFlush();
}
void init() {
glClearColor(0.0, 0.0, 0.0, 0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(-5.0, 5.0, -5.0, 5.0);
}
int main(int argc, char **argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(500, 500);
glutInitWindowPosition(0, 0);
glutCreateWindow("simple");
glutDisplayFunc(display);
init();
glutMainLoop();
return 0;
}
Comments