FLTK logo

STR #656

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]

Return to Bugs & Features | Roadmap 2.0 | Post Text | Post File | SVN ⇄ GIT ]

STR #656

Application:FLTK Library
Status:5 - New
Priority:1 - Request for Enhancement, e.g. asking for a feature
Scope:2 - Specific to an operating system
Summary:OpenGL and context deletion
Created By:dicuccio.comcast
Assigned To:Unassigned
Fix Version:Unassigned
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

Post File ]
Name/Time/Date Filename/Size  
#1 dicuccio.comcast
09:49 Dec 16, 2004

Trouble Report Comments:

Post Text ]
Name/Time/Date Text  
#1 dicuccio.comcast
09:48 Dec 16, 2004
On MacOS X, FLTK destroys and re-creates the OpenGL context if a Fl_Gl_Window is hidden and re-shown.  Doing this invalidates all display lists and texture objects associated with the OpenGL context, and leaves a number of rendering states undefined.  The attached patch implements an fl_hide_gl_context() function on MacOS X in the platform-specific section; this function cleanly maintains the previous OpenGL context and allows display lists and texture objects to survive beyond a window hide/show event.  
#2 mike
13:56 Dec 16, 2004
This is not specific to OSX, but is a general "feature" for all platforms. Hiding or deleting an OpenGL window destroys the OpenGL context associated with it.

There is a Fl_Gl_Window::context() method you can use to associate a common or long-lived context with a window.  However, the FLTK API used to create the contexts is currently not exposed.

We may be able to change the behavior such that the OpenGL context is only deleted when the widget is destroyed...
#3 anonymous
06:30 Dec 17, 2004
Hmmm, odd...  I've tested this on several graphics cards, and MacOS X is the only platform on which these errors are present.  Using an NVidia GeForce 5200, on Windows, I get preserved textures with multiple windows; on MacOS X, the texture objects disappear when a window is hidden.  We tracked it down to the destruction of the context, and forcing the context to remain long-lived solved the problem.  I would think that shifting context destruction to widget destruction would be the right thing to do, and would be a net gain overall.  This might still cause probelms when OpenGL windows are created/destroyed:

- create one OpenGL window (context 1)
- bind a texture to context 1
- create a new OpenGL window (context 2)
- texture object is shared across contexts and is visible in context 2
- close first OpenGL window, destroying context 1.  This leaves the texture object potentially undefined.
- the texture is no longer visible in context 2

This will need to be tested to see if this is what really happens.  I can certainly guard the texture code to make sure that textures are known to be valid prior to use, and this will at least cover the problem, but may leave some platforms on the slow path for texture rendering.

#4 mike
14:24 Feb 06, 2005
Reassigning this to 2.0 - we can't change things easily in 1.1.x, since mode changes need to be tracked...  

Return to Bugs & Features | Post Text | Post File ]


Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.