Handling loading/unloading of GL resources

Problems with Canvas, OpenGL, etc...

Handling loading/unloading of GL resources

Postby bauer » Sat Aug 28, 2010 1:09 pm

Hey all,

I have a brief question about how you are handling loading and unloading of your GL resources. My main problem is that everything requires a valid GL context, which I only really have in the onDraw() method.

I'm currently doing my loading in a subcall from the onSurfaceCreated() method, which works well, but I have no idea where to handle the equivalent unloading?

My main idea right now is to let each game state have a flag telling the manager if they've initialized/deinitialized their GL resources, and then during the onDraw() method it checks for those flags and calls the appropriate methods to load/unload. Although it feels very backwards in a way to do it like that so I'm sure there's a better way.

Please let me know of how you're doing it or if you have any general tips for me!

Once Poster
Once Poster
Posts: 1
Joined: Sat Aug 28, 2010 1:05 pm


Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 2 guests