Hi there. I’m trying to get back to doing some openGL programming but have come across a rather annoying and confusing problem
After I compile a program I’ve written (Borland bcc32 if that’s important) and try to run the .exe, I get a ’ test1.exe has encountered a problem and needs to close. We are sorry for the inconvenience’ error with windows asking if I want to send an error report (to who… me?). I assumed it was my programming ineptitude so I tired opening a simple exe (just opens a blank window) and the same error pops up. I don’t know what to do.
Any help you guys could give would be great.
Here’s the code. It’s as simple as I could make it to test that opengl works
#include <windows.h>
#include <GL/glut.h>
#include <stdio.h>
#include <stdlib.h>
void init ( void ) {
glEnable ( GL_DEPTH_TEST );
glClearColor ( 0.0, 0.0, 0.0, 0.0 );
}
void display ( void ) {
glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glutSwapBuffers ( );
}
void reshape(int w, int h) {
glViewport ( 0, 0, w, h );
glMatrixMode ( GL_PROJECTION );
glLoadIdentity ( );
if ( h==0 )
gluPerspective ( 80, ( float ) w, 1.0, 5000.0 );
else
gluPerspective ( 80, ( float ) w / ( float ) h, 1.0, 5000.0 );
glMatrixMode ( GL_MODELVIEW );
glLoadIdentity ( );
}
void keyboard ( unsigned char key, int x, int y ) {
switch ( key ) {
case 27: /* Escape key */
exit ( 0 );
break;
case ‘f’:
glutFullScreen ( );
break;
case ‘w’:
glutReshapeWindow ( 250,250 );
break;
default:
break;
}
}
int main ( int argc, char** argv ) {
glutInit ( &argc, argv );
glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE );
glutInitWindowSize ( 250, 250 );
glutCreateWindow ( argv[0] );
init ( );
glutReshapeFunc ( reshape );
glutKeyboardFunc ( keyboard );
glutDisplayFunc ( display );
glutMainLoop ( );
return 0;
}
Cheers.