views:

369

answers:

2

Is it possible to intercept a control's paint event and make it draw in the opengl context?

+2  A: 

I dont know if this is possible, but this tends to writing your own gui.

It whould be simpler to use a complete openGl Gui library.

http://libufo.sourceforge.net/

SuperPro
+1  A: 

If you're using Qt there's a fun demo showing (working) Qt widgets rendering 3D in an OpenGL context. How useful that is to you depends how how hooked you are on the native win32 controls specifically.

timday
QT is nice but is paid at the end. The open widgets for opengl I saw, I didnt like much. I was thinking in some direct hook on the win api so I found that WM_PRINT can in someway support it but not for all kinds of controls from what I read. Anyway, WM_PRINT uses a hDC (and I dont know exactly how to mix it with the hRC).
Ruben Trancoso
Have you considered using Direct3D instead of OpenGL ? There's a IDirect3DSurface9::GetDC method which will get you a HDC for a render surface (or at least these was in DirectX9; I believe it may be deprecated or even missing completely in DirectX10).
timday
I just came across it:http://www.qtsoftware.com/products/licensingQt has a LGPL license, so if I use it without modifications my code can remain closed. Looks good.
Ruben Trancoso
Ah sorry! I could have told you that but I didn't understand what you meant by "paid at the end". Have fun using Qt; it's truly great.
timday