Hi everyone.
I'm currently in the process of creating a simplified little Win32 / OpenGL wrapper for use in our maths class, so we can all mess about with transforms and matrices etc. quickly and easily. What I want to do is make a simple class which allows the user to display some common primitives, modify the transformation matrices and other such things and handle all of the details behind Windows programming.
I want to hide away as much as possible, all of the Win32 details especially the standard WinMain function. Presently the main part of program uses the standard Win32 template- and passes the hInstance paramter to the constructor for my OpenGL Window class, which it then uses when creating the window.
The code for this looks something like below:
#include <windows.h>
#include "GL_Window.h"
int WinMain
(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
);
{
// Create a new OpenGL Window which allows drawing etc..
GL_Window pWindow = new GL_Window( hInstance ); return 0;
}
What I'd prefer to do is replace WinMain with the standard main() function and have the window create its own process and handle in its constructor:
#include "GL_Window.h"
int main ( void );
{
// Create a new OpenGL Window which allows drawing etc..
GL_Window pWindow = new GL_Window(); return 0;
}
Is such a thing possible to do ? Or can only Windows itself create a new program space and pass the handle through WinMain ? It would be ideal if the GL_Window class could manage its own details completely without reliance on the main() function for paramters.
If anyone has any ideas or good links then i would be grateful. I've been looking through MSDN but haven't found anything to point me in the right direction, then again maybe i've been looking in the wrong places.
Cheers,
Darragh