I bought the OpenGL Superbible Fourth Edition and I have reached the ‘Your First Program’ section (Listing 2.1 for reference). I spent a while getting all the libraries setup and the program finally compiles with no warnings or errors, but when I run the program, the window doesn’t load up, there is just a blank console window. I copied the code pretty much word for word (with the exception of a char* constant for the window title). Here is the code:
/********** OpenGL Includes ********/
#include <gl/gltools.h>
/***********************************/
/********** Constants **************/
const char* WINDOW_TITLE = "OpenGL Test Program";
/***********************************/
/********** Draws the Scene ********/
void RenderScene()
{
// Clear the window
glClear(GL_COLOR_BUFFER_BIT);
// Flush drawing commands
glFlush();
}
/***********************************/
/****** Setup Rendering State ******/
void SetupRC()
{
glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
}
/***********************************/
int main(int argc, char* argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA);
glutCreateWindow(WINDOW_TITLE);
glutDisplayFunc(RenderScene);
SetupRC();
glutMainLoop();
return 0;
}
I am running on Vista using the Borland C++ compiler. As mentioned, the program complies fine using the command line:
bcc32 -DWIN32 ogl.cpp glut32.lib glu32.lib opengl32.lib
I have tried adding -L to each of the libraries and I get the same problem of the window not loading. I can’t advance further into the book until this is sorted and I have searched high and low for someone with a similar problem and have found nobody, so I guess I’m a first. Does anyone understand why the window does not show?
Edit: I guess this should have gone in the OpenGL Toolkits section, my bad, I only just noticed that section just now.