I’m having a problem with OpenGL using Visual Studio 2010 on a Windows7 x64 machine. I was originally porting code from a linux machine but upon encountering a problem I created a small test program to test whether OpenGL was performing properly.
In this case, I’m just using freeglut (Ver. 2.6) to create a window, which works fine, then trying to paint the window background color, but the program throws an exception on calling glFlush() and doesn’t draw anything in the graphics region of the created window, code provided below.
The exception reads: “First-chance exception at 0x7579e977 in HelloWorld.exe: 0xC000000D: An invalid parameter was passed to a service or function.”
I’ve already considered the possiblity of old drivers, those have been verified as up to date (Intel G33 integrated graphics card). Also, upon compiling freeglut, they provide a number of demo programs (e.g. smooth_opengl3) which also produce similar errors. Any ideas?
[b]//----------------------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------------------
#include <freeglut.h>
//----------------------------------------------------------------------------------
// Function Declarations
//----------------------------------------------------------------------------------
void init();
void display();
//----------------------------------------------------------------------------------
// Main
//----------------------------------------------------------------------------------
int main(int argc, char **argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(250,250);
glutInitWindowPosition(100,100);
glutCreateWindow(“Hello”);
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
//----------------------------------------------------------------------------------
// Init
//----------------------------------------------------------------------------------
void init() {
// Define basic OpenGL settings.
glClearColor(0.0, 0.0, 0.0, 0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0,1.0,0.0,1.0,-1.0,1.0);
}
//----------------------------------------------------------------------------------
// Display
//----------------------------------------------------------------------------------
void display() {
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
}[/b]