can you specify with some code. I`m not so sure what you ment with dialogbox?
but thanks for the reply.
Win32 rendering
start of with a main handle ;
HWND MainWindow = CreateDialog ( Instance, (LPCTSTR)ID_OPENGL_WINDOW, MainWindow, ProgramProc );
Then get the opengl screen(eg, a picture which is just put in the dialog using the resource editor, can be anything.)
the place and size of this object will be where you render the openGL
HWND Screen = GetDlgItem ( MainWindow, ID_WINDOW );
set device context
DC = GetDC ( Screen );
get the rectangle dimension for the openGL screen
GetClientRect ( Screen, &WindowRectangle );
set the pixelformat
SetPixelFormat ( bits );
do the rendering context
RenCont() = wglCreateContext ( DevCont() );
wglMakeCurrent ( DevCont(), RenCont() );
And then simply show the program
ShowWindow ( MainWindow,SW_SHOW );
SetFocus ( MainWindow );
ReSizeGLScene ( WinRect().right, WinRect().bottom );
InitGL ( );
Thats it
Don't even need to register the windowsclass (but it will be handy in the future)
HWND MainWindow = CreateDialog ( Instance, (LPCTSTR)ID_OPENGL_WINDOW, MainWindow, ProgramProc );
Then get the opengl screen(eg, a picture which is just put in the dialog using the resource editor, can be anything.)
the place and size of this object will be where you render the openGL
HWND Screen = GetDlgItem ( MainWindow, ID_WINDOW );
set device context
DC = GetDC ( Screen );
get the rectangle dimension for the openGL screen
GetClientRect ( Screen, &WindowRectangle );
set the pixelformat
SetPixelFormat ( bits );
do the rendering context
RenCont() = wglCreateContext ( DevCont() );
wglMakeCurrent ( DevCont(), RenCont() );
And then simply show the program
ShowWindow ( MainWindow,SW_SHOW );
SetFocus ( MainWindow );
ReSizeGLScene ( WinRect().right, WinRect().bottom );
InitGL ( );
Thats it
Don't even need to register the windowsclass (but it will be handy in the future)
thanks for the reply,
but what is "ProgramProc", ID_WINDOW and (LPCTSTR)ID_OPENGL_WINDOW
Fredrik
but what is "ProgramProc", ID_WINDOW and (LPCTSTR)ID_OPENGL_WINDOW
Fredrik
those are resources he specified in the .rc file. Program Proc is the WindowProcedure the dialog's messages are being sent to. Try MSDN if you don't understand these functions.
I`m still unsure where to put my render func. I know I have asked for alot and you have all been very helpfull. What I want to render is a terrain but first a load screen. A single tga which is on a quad.
Asking is what this forum (mainly) is for :)
Make your main something like:
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
LoadMenu ( Instance(), (LPCSTR) SID_MENU ); // load your menu
LaunchWindow ( " Title", 32 ); // open the window (the code from the previous post
while ( !done ) // start the drawin loop
{
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
// do message handling
}
else
{
DrawGLScene (); <--// GL render function here
}
SwapBuffers(DevCont());
}
return (msg.wParam);
}
Make your main something like:
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
LoadMenu ( Instance(), (LPCSTR) SID_MENU ); // load your menu
LaunchWindow ( " Title", 32 ); // open the window (the code from the previous post
while ( !done ) // start the drawin loop
{
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
// do message handling
}
else
{
DrawGLScene (); <--// GL render function here
}
SwapBuffers(DevCont());
}
return (msg.wParam);
}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement