Jump to content
  • Advertisement
Sign in to follow this  
backspin

Glut window on top

This topic is 3877 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 am using glut with mfc. Works ok, but is it possible to have the glut window always on top? MFC dialogs have such option ( SetWindowPos(&wndTopMost,.....) and I don't know if there is an option like this while creating glut window???

Share this post


Link to post
Share on other sites
Advertisement
i dont think you can, glut is a very simple windowing kit, if it can be called that way.
its main feature is the fact its fast and easy to setup a rendering window that will work on several operatin systems, but thats pretty much it (it has several other features ofc, but they're also rather simple).

Share this post


Link to post
Share on other sites
I know that glut is easy to work, but I studied every funtion and haven't found anything about having glut window created with "glutCreateWindow" always on top.

Share this post


Link to post
Share on other sites
ok, i found out a way to do this, but requires the use of 2 win32 API functions. the trick is to get the handle to the glut window and then use that handle to set the window always-on-top (can be used for many other win32 API calls).
on your main() function (or in whatever function you setup your window):


glutCreateWindow( "ogl" ); //create window with glut
HWND hwnd = FindWindow( "GLUT", "ogl" ); //get its handle "GLUT" = class name "ogl" = window caption
SetWindowPos( hwnd, HWND_TOPMOST, NULL, NULL, NULL, NULL, SWP_NOREPOSITION | SWP_NOSIZE ); //set the window always-on-top





one final note, set the character set to "Multi-Byte character set" on the general project options on visual studio or else it will give a compilation error on FindWindow(...) call (at least on visual studio 2005).

hope that helps.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!