Jump to content
  • Advertisement
Sign in to follow this  
GCoda

OpenGL glut and HWND

This topic is 4596 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm trying to use direct input with openGL and the problem I ran into is that direct input needs the window handle (HWND). But since I'm using glut to create the window I don't have the handle... So is there anyway to get the handle? By the look at glut function reference there doesn't seem to be a way but maybe there's some windows function that can be used to get the HWND? Or am I forced to give up using glut? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
I'd recommend giving up on GLUT. You may want to instead try GLFW or SDL for your windows management; both provide more robust input handling than GLUT does.

Share this post


Link to post
Share on other sites
A little googling gives some methods. You can use the Win32 API function FindWindow() to find a top-level window such as yourown. A bit of a work around but possible. See here for someone using it that way.

@SciCrane: he is using DirectInput for input, not Glut, as said in his post. If that's what you meant that is.

Illco

Share this post


Link to post
Share on other sites
My point being that if he used a windowing framework with more robust input support then he may not need to use DirectInput in the first place.

Share this post


Link to post
Share on other sites
DirectInput is good enough and supports many input devices. I haven't tried all those wrappers(maybe one of them is using GI as base, like openAL uses DirectSound), cause i dislike not to have done something myself, but i use DI in OpenGL and have no problems.

Share this post


Link to post
Share on other sites
Thanks for the replies, all good answers there!

I got the handle with FindWindow but when I call acquire on mouse device the call fails returning DIERR_HANDLEEXISTS. But if I create the window instead of letting glut do it (and use direct3D) the acquire doesn't fail.

So I quess it's just too tricky to get openGL (especially with glut) working with DX. Hmm, maybe I just provide DX support only for windows then. Or use SDL.


DIERR_HANDLEEXISTS:
The device already has an event notification associated with it. This value is equal to the E_ACCESSDENIED standard COM return value.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!