Sign in to follow this  
backspin

Glut window on top

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
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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this