Skip to main content
GameDev.net gamedev.net
🔒 Locked

Getting an HDC(Solved)

Started by kburkhart84 Sep 27, 2005 at 7:56 PM 2 replies 1k views
Original Post
kburkhart84
kburkhart84
I have made a wrapper with OpenGL. I'm trying to make a font wrapper as well, but to select the font in order to convert it for use with OpenGL, I have to have the HDC variable. That variable is created and used in the OpenGL window wrapper and I really don't want the two classes communicating, nor do I want to have to pass the HDC from the calling function(usually WINMAIN) into the setup function of the font. Is there a way to get the HDC value. I have seen GetModuleHandle(), but when you use a NULL argument to that function, it returns the HINSTANCE. That would work, if using the HINSTANCE, I could get the HDC. Can this be done or will I have to pass the HDC into the setup function? Thanks in advance. [Edited by - kburkhart84 on September 27, 2005 8:34:17 PM]


KittyRa
KittyRa
I'm not really sure what you are doing but how about using a global HDC and GetDC(). However, I have a feeling that this is a horrible idea.
F-R-E-D F-R-E-D-B-U-R...G-E-R! - Yes!
kburkhart84
kburkhart84
Well, the hwnd argument for the GetDC function is in the same class as the DC I'm trying to get. Though I just had an idea. I think maybe OpenGL itself has a function to get the DC. I'll try the OpenGL forum if I can't find it. Thanks for the help. I tried the GetDC with a NULL, but that didn't work.


kburkhart84
kburkhart84
Actually, I looked in the wgl functions that make OpenGL connect with windows. There is a function to get the current HDC their and it worked. Thanks for the help.


Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.