Bug 993 - Make JOGL's tracking information public
Summary: Make JOGL's tracking information public
Alias: None
Product: Jogl
Classification: JogAmp
Component: opengl (show other bugs)
Version: 2
Hardware: All all
: --- enhancement
Assignee: Sven Gothel
Depends on:
Reported: 2014-03-05 23:26 CET by PJDM
Modified: 2014-07-10 14:36 CEST (History)
0 users

See Also:
Type: ---
SCM Refs:
Workaround: ---


Note You need to log in before you can comment on or make changes to this bug.
Description PJDM 2014-03-05 23:26:11 CET
JOGL internally tracks buffer targets. Please make this information public, it would (hopefully) make debugging buffer usage much easier.

(See discussion at http://forum.jogamp.org/Detecting-memory-leaks-td4031771.html.)
Comment 1 Sven Gothel 2014-07-10 14:36:20 CEST
'gl.getBoundBuffer(target)' lets you query the buffer bound to a specific 

'gl.getBufferStorage(int bufferName)' gives you the GLBufferStorage 
as created via 'gl.glBufferData(..)' or 'gl.glNamedBufferDataEXT(..)',
see GLBufferStorage API documentation!

Further more, GLBufferStorage.getMappedBuffer()
gives you a mapped NIO buffer for that storage as mapped
via 'gl.glMapBufferRange(..)' etc.


So what object states do we track currently:
  - object -> target binding
  - GLBufferStorage of object-name w/ storage created
  - GLBufferStorage's mapped NIO buffer

what do we _not_ track:
  - buffer-names which are not bound to target
  - GLBufferStorage of object-name w/o storage created

so one could ask whether a buffer-name has a storage created,
simply by 'null != gl.getBufferStorage(bufferName)', etc.

Bug closed. 


In GLBase you have:


    * @param target a GL buffer (VBO) target as used in {@link GL#glBindBuffer(int, int)}, ie {@link GL#GL_ELEMENT_ARRAY_BUFFER}, {@link GL#GL_ARRAY_BUFFER}, ..
    * @return the GL buffer name bound to a target via {@link GL#glBindBuffer(int, int)} or 0 if unbound.
    * @see #getBufferStorage(int)
   public int getBoundBuffer(int target);

    * @param bufferName a GL buffer name, generated with e.g. {@link GL#glGenBuffers(int, int[], int)} and used in {@link GL#glBindBuffer(int, int)}, {@link GL#glBufferData(int, long, java.nio.Buffer, int)} or {@link GL2#glNamedBufferDataEXT(int, long, java.nio.Buffer, int)}.
    * @return the size of the given GL buffer storage, see {@link GLBufferStorage}
    * @see #getBoundBuffer(int)
   public GLBufferStorage getBufferStorage(int bufferName);


.. further more, you have:


    * @return true if a VBO is bound to {@link GL#GL_ARRAY_BUFFER} via {@link GL#glBindBuffer(int, int)}, otherwise false
   public boolean isVBOArrayBound();

    * @return true if a VBO is bound to {@link GL#GL_ELEMENT_ARRAY_BUFFER} via {@link GL#glBindBuffer(int, int)}, otherwise false
   public boolean isVBOElementArrayBound();