Re: [GtkGLExt] Fwd: reparenting a GtkDrawingArea with OpenGL
- From: Braden McDaniel <braden endoframe com>
- To: gtkglext-list gnome org
- Subject: Re: [GtkGLExt] Fwd: reparenting a GtkDrawingArea with OpenGL
- Date: Wed, 20 May 2009 15:08:57 -0400
On 5/20/09 2:43 PM, Jeff Eberl wrote:
After a lot of print statements, and some new callbacks, I've discovered
half of the problem.
I was keeping the gtkContext* around, and it's been invalidated. So a
simple call to gtk_widget_get_gl_context fixed that.
I connected to the realize and unrealize signals, and the remove calls
unrealize, and the add calls realize. But there is another problem, the
glLists and glTextures seem to be getting invalidated. Looking at the
gears code, it looks like the realize creates a new list (glGenList) but
there's no where that the list gets deleted. Does this mean the gears
app is leaking video resources? Or is it getting cleaned up somewhere?
Technically, yes. But I think that the video driver will clean up any
resources associated with the context when the context goes away.
For now, I'm going to delete all lists and textures in the unrealize
event, and create them again in the realize event. I'm hoping this is
overkill, and someone knows how to fix, or revalidate the lists/textures
without completely reallocating them.
I think deleting them yourself is the safe, responsible thing to
do--kind of like freeing memory in a C program. Sure, most modern
operating systems will reacquire the memory when the process ends; but
even in programs that aren't expected to be long running it's considered
good practice to release resources when you're done with them.
I do not think there's any way to "revalidate" these resources. But are
you really going to be swapping these widgets around so much that the
cost of reallocation is likely to be onerous?
--
Braden McDaniel e-mail: <braden endoframe com>
<http://endoframe.com> Jabber: <braden jabber org>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]