to get HDC???

Started by
1 comment, last by jobrady 22 years, 2 months ago
When I started learning opengl it was using the "glutCreateWindow" command to set up a window but since then Ive found that I often need to pass in a device context as a parameter(but without getting hwnd at setup I cant find a way to get hdc). Can anyone tell me if I can get HDC or hwnd some other way or do I need to go back and rewrite my code. Is using glut just a crap way to program opengl???? Sorry for such a stupid question but Id be really grateful if someone can help me. Thanks, Joe
Advertisement
Trying looking at Nehe''s base code.
It should show you in the createwindow function how to get the hdc.

p.s. glut is alright if you want to build something very quickly and not very programmer literate, building applications without glut are usually more powerful and efficent in my experience.
unless you want your game or program or whatever to be cross-platform, i''d advise you to use Win32 API and disregard glut altogether. besides - where do you need to access the hdc directly?
i''ve never used glut so maybe i''m stumbling in the dark here, but just about the only functions you need a hdc for are the ChoosePixelFormat and SwapBuffers. if you need to access the hdc for some other reason i doubt that you would be needing openGL at all for that ok, i admit, this doesn''t make much sense to me (there are probably other more relevant glut functions for this) as you need a hwnd to get the hdc, but still - if you don''t want your game to run on Linux, Mac or Irix or whatever, stick to the bulky MS solution. that''s a personal opinion, so please don''t flame me anyone

crispy

"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared

This topic is closed to new replies.

Advertisement