View Full Version : draw while resizing window
02-14-2002, 10:29 AM
My question is not directly opengl related.
I'm looking for the way to keep drawing (and updating) my gl scene while the user is resizing the window (under win2k).
I'm trying to catch WM_SIZING messages but there must be something I've missed.
02-14-2002, 12:24 PM
It works very well with glut if I put a glviewport in my reshape function and then redraw the scene but now I'm trying to do it without glut.
02-15-2002, 09:58 AM
well, it seems that it's not possible with double-buffering...
02-15-2002, 08:50 PM
It works fine for me. I'm not using glut. During the WM_SIZE event I note the new size, along with the fact that a resize occurred, but nothing else. During the WM_PAINT event I check if a resize occurred, and if so I call glViewport with the new size, and then gluPerspective with the new aspect ratio.
This works for me in Win 98 Second Edition as long as I have the "Show window contents while dragging" checkbox checked in the Effects tab of the Display Properties. If I uncheck that checkbox, it reverts back to outline resize mode, but this is what it should do. If people want outline resize mode, I don't think it's my job as a developer to try to fight them on it.
02-16-2002, 03:06 AM
I used NeHe tutorial on "how to set up openGL under Windows" so I wasn't drawing the scene during WM_PAINT events but in the main loop (the NeHe tutorial has exactly the same problem as mine http://www.opengl.org/discussion_boards/ubb/frown.gif). I tried doing as you said and moved my drawing from the main loop to WM_PAINT handling code but then the scene is never drawn !
Here's my message proc code :
LONG WINAPI WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static bool resized = true;
static int dx=WIN_DX, dy=WIN_DY;
glViewport(0, 0, dx, dy);
resized = false;
resized = true;
dx = LOWORD(lParam);
dy = HIWORD(lParam);
keys[wParam] = true;
if(wParam == 27)
keys[wParam] = false;
return DefWindowProc(hWnd, uMsg, wParam, lParam);
and This is my main loop :
// removed the drawing code from here
Anything horrible in my code ?
(by the way, I have checked "draw window content while dragging" too)
[This message has been edited by zeraiam (edited 02-16-2002).]
02-16-2002, 03:28 AM
I think, that you have to call your drawing routine directly from WM_SIZE as WM_PAINT is first called when you finished resizing (I think!!!)
02-16-2002, 04:49 AM
well I tried that but it didn't work. http://www.opengl.org/discussion_boards/ubb/frown.gif
When I use single buffering it works perfectly but there is something wrong with double-buffering.
I've had a look at glut source code but I couldn't find out the magic part (I might be more confused now in fact).
02-16-2002, 11:58 AM
Put this wm_paint code in the wm_size event as well and it should redraw the scene during a resize.
glViewport(0, 0, dx, dy);
02-17-2002, 10:24 AM
http://www.opengl.org/discussion_boards/ubb/confused.gif http://www.opengl.org/discussion_boards/ubb/confused.gif http://www.opengl.org/discussion_boards/ubb/confused.gif
It only works when I don't set the PFD_DOUBLEBUFFER flag in the PIXELFORMATDESCRIPTOR structure.
I've read in the helpfile that : "This flag (PFD_DOUBLEBUFFER) and PFD_SUPPORT_GDI are mutually exclusive in the current generic implementation". Does it have something to do with my problem? If so, how do they cope with it in glut ?
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.