   Free GLUT problems[SOLVED]
  I am having some problems with GLUT.The reason why I am using GLUT is this:The code that I wrote for GL stuff,(based on NeHe's tutorials)crashes when I try to switch to windowed mode when in fullscreen mode.See my below post for my problems with Free GLUT.Here are my problems:1.When I try to close the created window,the process is not exited.I am using Dev-Cpp, and the library(.a file)which came with it. For the header and DLL,I downloaded them seperatly.I just want it setup so there is no console,and the process exits when the window closes.2."Game" mode, or fullscreen mode won't work.It tries to switch, then after that,it flickers back to the way it was.3.How do I execute a function when the window is closed?Another question: How do make the program quit from code?4.I am having problems with viewports.When I only call glViewport,it dosen't do anything.But when I use this code instead,it won't let anything be drawn.This is the same program as in the topic I posted in the generalprogramming section.[Edited by - yellowstar on September 9, 2007 5:35:05 PM]
  Try using freeglut instead of glut.  I switched a few days ago and found it to be far more useful and easier to work with in terms of handling multiple windows AND being able to specify exactly what happens when a window closes.  GLUT will simply call exit(1) when a window closes, but freeglut allows you to cause the glutMainLoop to return, which then lets you execute the rest of your main().   ;  I downloaded freeglut.But I can't find the library file.Where is it?;  personally im using glfw [smile]   ;Quote:Original post by yellowstarI downloaded freeglut.But I can't find the library file.Where is it?You have to compile it in visual studio.  It should compile without any problems.  Also, be sure NOT to use the static project.  Just compile the first one and then go into the Release folder.  The freeglut.dll and freeglut.lib will be in there.  Use those.   ;Quote:Original post by soconneQuote:Original post by yellowstarI downloaded freeglut.But I can't find the library file.Where is it?You have to compile it in visual studio.  It should compile without any problems.  Also, be sure NOT to use the static project.  Just compile the first one and then go into the Release folder.  The freeglut.dll and freeglut.lib will be in there.  Use those.I am using the MS Visual Cpp 2005 Express version.I don't have the Windows SDK.And I don't want to download it just to compile this.(I use Dev-Cppfor native Windows stuff. The main reason why not is becauseI'm stuck with slow Internet.)Could somebody post a links to downloadthe lib file, and the DLL?;  Here, I just compiled it and uploaded a copy of the lib, dll and include files.http://cs.selu.edu/~soconnell/freeglut.zip;  I have switched to Free Glut.Problem # 1 is fixed.(The problem with the process notexiting with the window.)But, I am still having problems with the other problems."Game" mode, or fullscreen mode,won't work on either of my computers.When the screen resolution is notthe desired resolution,it crashes.On my old computer,it throws a Windows Error.On my newer computer,(XP)it changes the resolutionsuccessfully, but,it won't clear the whole screen.Then it crashes.But, when the screen resolution is correct,(only tested on my old computer)it has almost the whole screen black,with some blue on the top of the screen.When I end task the Shell,It displays the window,in fullscreen mode.I don't want the window displayed.I am having problems with having my program executea function when the program exits.(Or the window)How do I do this?I'd like to use glutMainLoop,but that won't return to the calling function.I can't use glutMainLoopEvent,since there is no way,with that function,to know if the user pressed theX button.;  Well if you're going into fullscreen mode, you do NOT create a window.  Take out any calls to glutCreateWindow, glutInitWindowPosition and glutInitWindowSize.As for the glutMainLoop not returning to the calling function, this is how it is suppose to work.  I didn't like this either, so I modified the source code for freeglut and added my own function called glutMainLoopCallOnce, which calls EVERYTHING in MainLoop, unlike glutMainLoopEvent.  So my loop looks like this:while(1) {    glutMainLoopEvent();    // do whatever I need to do}And the way I figure out when to exit, is I set the glutCloseFunc for my main window, and when that event is fired, I know to exit my custom while loop.But in your case, since you are in fullscreen mode and there is no window, you could simply do:while(running) {glutMainLoopEvent();// do whatever}Then in your glutKeyboardFunc callback, set running=false if you press Escape or something.   ;Quote:Original post by soconneWell if you're going into fullscreen mode, you do NOT create a window.  Take out any calls to glutCreateWindow, glutInitWindowPosition and glutInitWindowSize.That failed.Once it switches the resolution,it draws the desktop and ect.It dosen't clear the screen,so anything that is drawn before the switch to fullscreen,or while to program is running, stays.EDIT:Free GLUT isn't calling the keyboard and display callbacks.