ColacX
06-18-2009, 05:03 PM
so i managed to create 2 windows and get them to render my opengl world.
only problem is that the processor takes 90% cpu-power compared to the lowly 3% with one window.
what i've done is that after each frame is drawn i switch the renderingcontext with the 2nd window renderingcontext.
else if(isFirstWindow) // Not Time To Quit, Update Screen
{
if(!wglMakeCurrent(hello1,hello2)) // Try To Activate The Rendering Context
{
KillGLWindow(); // Reset The Display
MessageBox(NULL,"Can't Activate The GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE; // Return FALSE
}
DrawGLScene(); // Draw The Scene
SwapBuffers(hello1); // Swap Buffers (Double Buffering)
//SwapBuffers(hDC); // Swap Buffers (Double Buffering)
isFirstWindow=false;
}
else // Not Time To Quit, Update Screen
{
if(!wglMakeCurrent(hDC,hRC)) // Try To Activate The Rendering Context
{
KillGLWindow(); // Reset The Display
MessageBox(NULL,"Can't Activate The GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE; // Return FALSE
}
DrawGLScene(); // Draw The Scene
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
isFirstWindow=true;
}
hello1 is the device context handler for window1
hello2 is the rendering context handler for window2
something about the switching is draining cpu
so i wonder is there some way to just swap the buffers and make it work?
something like
else if(isFirstWindow) // Not Time To Quit, Update Screen
{
DrawGLScene(); // Draw The Scene
SwapBuffers(hello1); // Swap Buffers (Double Buffering)
isFirstWindow=false;
}
else // Not Time To Quit, Update Screen
{
DrawGLScene(); // Draw The Scene
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
isFirstWindow=true;
}
only problem is that the processor takes 90% cpu-power compared to the lowly 3% with one window.
what i've done is that after each frame is drawn i switch the renderingcontext with the 2nd window renderingcontext.
else if(isFirstWindow) // Not Time To Quit, Update Screen
{
if(!wglMakeCurrent(hello1,hello2)) // Try To Activate The Rendering Context
{
KillGLWindow(); // Reset The Display
MessageBox(NULL,"Can't Activate The GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE; // Return FALSE
}
DrawGLScene(); // Draw The Scene
SwapBuffers(hello1); // Swap Buffers (Double Buffering)
//SwapBuffers(hDC); // Swap Buffers (Double Buffering)
isFirstWindow=false;
}
else // Not Time To Quit, Update Screen
{
if(!wglMakeCurrent(hDC,hRC)) // Try To Activate The Rendering Context
{
KillGLWindow(); // Reset The Display
MessageBox(NULL,"Can't Activate The GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE; // Return FALSE
}
DrawGLScene(); // Draw The Scene
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
isFirstWindow=true;
}
hello1 is the device context handler for window1
hello2 is the rendering context handler for window2
something about the switching is draining cpu
so i wonder is there some way to just swap the buffers and make it work?
something like
else if(isFirstWindow) // Not Time To Quit, Update Screen
{
DrawGLScene(); // Draw The Scene
SwapBuffers(hello1); // Swap Buffers (Double Buffering)
isFirstWindow=false;
}
else // Not Time To Quit, Update Screen
{
DrawGLScene(); // Draw The Scene
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
isFirstWindow=true;
}