PDA

View Full Version : How do I get the handle fo an OpenGL window?



Debugger
01-28-2007, 05:23 AM
After creating a window via glutCreateWindow(), how can i get the handle of this window?

Zengar
01-28-2007, 07:30 AM
You can't. There are different window managers (win32, X etc.) around and libraries like GLUT are created to hide that differences. If you work with Windows, you could try to obtain the DC of the current window by using wglGetCurrentDC, but I don't know any win32 function that would retrieve the window handle from a dc... My advice: if you need the window handle, create your window manually.

Debugger
01-28-2007, 03:48 PM
OK, I will take a try, int fact, I want to retrive the default value of an OpenGL window's position and dimension, so I use the Win32 function GetWindowInfo, but you know the first parameter of this function is the window's handle, so I need it, maybe there is something else can perform this, I don't know.

Thank you !

sqrt[-1]
01-28-2007, 05:46 PM
Try:
wglGetCurrentDC
Then
WindowFromDC

http://msdn2.microsoft.com/en-us/library/ms534898.aspx