PDA

View Full Version : OpenGL and windows.h: how not to stop rendering



Black Imp
07-08-2006, 03:49 PM
Hi. It's the first time I've used windows.h library to have a rendering context for opengl, I've still a lot to learn. Each time I activate menus or simply move the rendering window over the desktop the rendering stops - it pauses, better. Similarly if I select from the menu to open a file an explorer window correctly opens but if I move it over the rendering window it draws it's image upon it until I close it and the rendering starts again - reprises. Do you know if there's a way to tell Windows to keep on rendering while some event happens to the rendering window? please notice I'm not using MFC but only windows.h and Visual C++ 6.0
Thank you

des
07-11-2006, 12:11 AM
I think if your application is something dynamic like game, you should call draw functions in main loop. In other way you just need to process WM_PAINT message, coming from Windows, did you process it?

Black Imp
07-11-2006, 06:22 PM
yes I process it but not in the main window callback function, so non that way ( by WM_PAINT ). I followed nehe's tutorial ... mmmh you gave me a real good hint... let me try :)
thank you

Black Imp
07-11-2006, 08:16 PM
ok I modify my window callback function. now it manages the case msg==WM_PAINT:


case WM_PAINT:
PaintCanvas();
SwapBuffers(hDC);
break;


but before it handles a menu entry in the case COMMAND... it should open a messagebox... well if you select that menu entry the window goes on rendering but it becomes inactive and you cannot even move it and the messagebox does not appear. now if you press ALT the message box appears and you can close it by OK button and then the window gets active again. so now I've resolved the rendering problem but I have a new one with messagebox opened from the same thread as the one calling the rendering function - that is the windows process...the window callback function -.

SOB! :(


SORRY! I've just noticed there's a more appropriate section of this forum for my question. I'll try overthere.

Black Imp
07-11-2006, 09:18 PM
SOLVED: I used a timer initialized under the main windows function with the last parameter of SetTimer set to NULL. inside the windows callback function if msg==WM_TIMER... Paint();SwapBuffer(hDC);break;

Now it shows messagebox and it keeps on rendering as well.