glDeleteBuffers Very Inconvenient.
Posted by millerni456 on Jan 22, 2013; 10:51pm
URL: https://forum.jogamp.org/glDeleteBuffers-Very-Inconvenient-tp4027988.html
Hello All,
I've run into an issue with Java OpenGL:
The issue is that if I want to delete any buffers that I generated (such as for VBO's), and I am required to have a handle to an OpenGL context.
But, in a game, if I constantly recreate these buffer, I will need to keep cleaning after myself (which unfortunately reveals the abstraction Java has).
Also, I need to be able to delete these buffers on a non-OpenGL thread.
I realize there are ways to get the OpenGL context on a thread that doesn't have one, but If I continually do this, wouldn't this create a major performance drop?
Anyways, I was really hoping there would be some way that Garbage Collection would delete these buffers, but that doesn't seem possible.
--Note: On a previous game I made, I preallocated say 1000 renderable objects that have buffers associated with them. Then when terminating the game, I would then delete all of these buffers.
During game play I would reuse these preallocated objects so that I didn't ready into a OutOfMemoryError.
(This isn't very much a Java way to handle things, and although cumbersome, it was possible.)
I'm hoping very much that there is a solution/workaround that is feasible! :)
I greatly appreciate any feedback for discussion or advice you have to offer.
God bless!
-Nick.