Hello and welcome to the "freeglut" community!

        I can't speak for the correctness of your solution, but I don't see anything wrong with it.  If it works, I would use it.

        I think the reason "freeglut" doesn't automatically save and restore an existing X context is that it was not designed to be a "plug-in".  It was, I think, designed to be the basic windowing library for small programs.  The GLUT library, of which "freeglut" is supposed to be a clone, actually specifies that control NEVER returns to the main program after the call to "glutMainLoop".  That is one of the design decisions that was reversed when "freeglut" was written.

John F. Fay
Technical Fellow, Jacobs/Sverdrup TEAS Group
-----Original Message-----
From: [] On Behalf Of Rob Pieké

Sent: Tuesday, October 03, 2006 11:03 AM
To: FreeGLUT developers list
Subject: [Freeglut-developer] Newbie question about context saving/restoring

(Sorry if this is in the mail archives ... I don't seem to be able to access them)

I'm trying to use freeglut in a plugin to an application which already uses OpenGL. It looks like freeglut is creating a new context for its window, making that context the current one, and then destroying the context when the window is closed. What doesn't seem to be happening is any sort of previous context save/resore, which I'm curious about. I was getting some nasty GL errors in the app until I changed my plugin to have:

oldContext = glXGetCurrentContext( ... ); glutMainLoop(); glXMakeCurrent( ..., oldContext );

Is this "right"? Is there a design reason this isn't done automatically by freeglut?


Take Surveys. Earn Cash. Influence the Future of IT Join's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash

Freeglut-developer mailing list