Well, this is the story. I am doing a large project as my thesis work and a 3D view is not required of me but would be a very cool thing to do. The app is used to control a robot's movement graphically from the PC, done in Win32 API (no MFC). I am trying to make a child window display the rotating cube from NeHe's tutorial 5, but I haven't been able to do so. I cannot get DrawGLScene() in WinMain. I need to display the OpenGL window in a child window contained in a window opened from a dialog that is called from winmain. I register the class for the window when the program initializes like this:
wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wndclass.lpfnWndProc = (WNDPROC) TrayViewPortGLProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = g_hInst;
wndclass.hIcon = NULL;
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = NULL;
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = "TrayViewPortGL";
if (!RegisterClass (&wndclass))
{
MessageBox (NULL, "foo", "RectWndProc", MB_ICONERROR);
return 0 ;
}
Then, when the window is opened in WM_CREATE I call:
if(!(g_hwndVPGL=CreateWindow("TrayViewPortGL", NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 0, 0, 0, 0, hwnd, NULL, g_hInst, NULL)))
{
MessageBox(NULL,"g_hwndVPGL.","ERROR", MB_OK | MB_ICONEXCLAMATION );
}
And inmediatly I resize it to the size I need it to be (not 0). Now, in a separate project file I include the win proc for this child window and the GL helper functions, modified so they dont include fullscreen (I dont need that) and I call DrawGLScene() from WM_PAINT in the child window.
Since it is a little large and here it would get messed up, the source is at this url:
http://venturello.com/files/TrayViewPortGL.cpp
As I compile the app, there is no error reported, and I notice a slowdown as some heavy processing is being done, but I dont see any results on screen.
I am just beggining on opengl. As you can see my understanding is very basic, I have no idea how to apply it to this specific situacion - I just di what I could to make Tutorial 5 work in my situation - which it did not. I only need to display very basic objects (lines, simple curves, simple solids, no textures, basic rotation, no lightning) but I dont want to do all the 3D projections myself (know how the math work, but openGL looks nicer). Nothing fancy, but I need it to be efficient and not hug down the computer. No movement save under user command to rotate the viewport.
Thanks for any help you can give, I knwo this is a long question. I will be looking at the post to see if there is any specific question. Again, thanks beforehand for any help.
Juan Miguel Venturello
Edited by - DaEvOsH on January 29, 2001 6:34:42 PM
Edited by - DaEvOsH on January 29, 2001 7:31:00 PM
Edited by - DaEvOsH on January 29, 2001 7:36:25 PM