PDA

View Full Version : opengl window below something



miko
03-31-2003, 01:52 PM
and another problem on win98: when i create gl context it's always on top of other windows... is it possible to force gl window to look like normal serious window, so when drag something in front of it, it's not visible?

window isn't double buffered and supports gdi but it's still beating others... heeeelp!

shinpaughp
03-31-2003, 03:25 PM
Is this a win32/MFC app and you want it to stop processing when it is beneath another window?

If so, use WM_ACTIVATE to test for deactivation and adjust code accordingly.

If not, give a little more detail.

Is this a GLUT app? What are yuou using?

miko
04-01-2003, 03:22 AM
it's not mfc app and it's not using glut too (it's too dependent on win32 function so glut don't increase poratbility anyway)

handlig of WM_ACTIVATE is the one i have been already thinking about and it's my last hope.

my new idea is to chcek for WM_ACTIVATE, and when this happens, start rendering to offscreen buffer and copy image to my window via gdi functions (yeah performace will fall but performace isn't such important). it could work but isn't there some better approach?

Deiussum
04-01-2003, 05:30 AM
What styles did you specify for creation of your window? Sounds like maybe you have the topmost flag set.

miko
04-01-2003, 06:49 AM
i think not but if you really want to see it:

mainclass.style = CS_OWNDC;

....

hwnd = CreateWindowEx(0, "MAINWINDOWCLASS",
"my little window", WS_TILEDWINDOW, 100, 100, 200, 200, NULL, NULL, inst, NULL);

....

PIXELFORMATDESCRIPTOR pfd;

....

pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_SUPPORT_GDI;

window itself is not visible it's hiding perfecly, but only gl context is over everything. i think it's caused by my opengl itself because it's directly rendering to region of video memory of my context and don't care about anything (that's only reason i can think of)

the most weird think is when i started to write code i checked this and it seemed to be ok. but something happened and now i'm lost http://www.opengl.org/discussion_boards/ubb/frown.gif

shinpaughp
04-01-2003, 11:02 AM
Do you call wglMakeCurrent with the front window to pass control so to speak to that window not just at initialization of the window? When you switch windows, you should do that. Are they both OpenGL contexts? Though I'm still not entirely clear what is going on that you want to occur.

[This message has been edited by shinpaughp (edited 04-01-2003).]

Deiussum
04-01-2003, 12:57 PM
I'm not sure if this is the same problem, but I remember once having a problem where the menu seemed to get drawn over by the OpenGL context. Turns out, in my idle time to refresh the scene I was calling Invalidate(). That's all fine and dandy, but I did not call Validate at the end of my draw routine. I added the Validate in there and all was good. Maybe you have a similar situation.

Edit: This is generally only a problem with apps using the Win32 API. MFC apps automatically call Validate for you, in one of the base classes, I believe.

[This message has been edited by Deiussum (edited 04-01-2003).]

miko
04-02-2003, 02:12 AM
deiussum: thanx, i'll try it!