HDC, HWND and GLUT

I’d like to use wglFontOutlines & wglFontBitmaps, but they require HDC. To get HDC I must have HWND of the window I’m rendering to, but I have 2 windows in GLUT. Is there some way to get HWND of rendering window?

??
I know that I could get dc by caling hDC=GetDC(hWnd), but hwnd is usually assigned value by function CreateWindowEx(…, in glut I window is allready created
Do I have to get hdc by parsing all active windows & checking their titles??? What do you people do when you have to set up pbuffer, hdc is needed too…

Why do you use GLUT then? If you use Windows specific code (wgl…) you may as well set up your OpenGL window (and rendering context) yourself.

You could search the GLUT source, where window handles are stored, GLUT won’t expose these, however (I think), since this would mean to lose cross platform compatibility.

Platform independence is out of the way if you use wgl functions, means you can also use:
HGLRC wglGetCurrentContext(void);
HDC wglGetCurrentDC(void);

Hint, it sometimes helps if you have a look at a function reference list.

Don’t want to jump to pure w32 app right now, but will do that. About function list, havn’t found a place to find them all together.

Anyway, thanks

Try GetActiveWindow() maybe it will work

wglGetCurrentDC works like it should, thanks.

Originally posted by M/\dm/
:
[b]About function list, havn’t found a place to find them all together.
B]

For any Windows related programming question MSDN is the first choice.

E.g. wgl functions are here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/ntopnglo_4e7n.asp