I have been writing demo applications using OpenGL recently in C++. I documented how to set up the environment and create a project in my article OpenGL and Visual Studio Express 2008. I started out by writing the application as a Win32 application. This was a problem though.When you are doing it in a Win32 project instead of a Win32 Console project it makes it very hard to do simple debugging using print statements. If you are like me, I like to scatter prinf or cout statements through different parts of my code so I can trace the progress and examine variables during development. It makes it very easy.If you use these statements in a Win32 project however, this output does not get printed out to the console or anywhere for that matter. It is just eaten and no errors are incurred.
My Solution to Logging On Win32 Projects
The correct solution, which I didn’t do, is to create a logging interface. Either create a separate dialog window that you can write your statements to or have it write to a file. This way, you might be able to cover off your logging system at the same time (if your application needs it).What I actually did was another story. I switched my project to a Win32 console application. This gives you just the regular main method for your application and dumbs it down a bit. You also don’t need to include the windows.h header file. The catch is that you must use the OpenGL Utility Toolkit … glut to create your windows for drawing your OpenGL demos in. I wrote about it in my OpenGL and Visual Studio Express 2008 tutorial.
Leave a Reply