public class GLBufferStateTracker
extends java.lang.Object
Note that because the enumerated value used for the binding of a buffer object (e.g. GL_ARRAY_BUFFER) is different than that used to query the binding using glGetIntegerv (e.g. GL_ARRAY_BUFFER_BINDING), then in the face of new binding targets being added to the GL (e.g. GL_TRANSFORM_FEEDBACK_BUFFER_NV) it is impossible to set up a query of the buffer object currently bound to a particular state. It turns out that for some uses, such as finding the size of the currently bound buffer, this doesn't matter, though of course without knowing the buffer object we can't re-associate the queried size with the buffer object ID.
Because the namespace of buffer objects is the unsigned integers with 0 reserved by the GL, and because we have to be able to return both 0 and other integers as valid answers from getBoundBufferObject(), we need a second query, which is to ask whether we know the state of the binding for a given target. For "unknown" targets such as GL_TRANSFORM_FEEDBACK_BUFFER_NV we return false from this, but we also clear the valid bit and later refresh the binding state if glPushClientAttrib / glPopClientAttrib are called, since we don't want the complexity of tracking stacks of these attributes.
Constructor and Description |
---|
GLBufferStateTracker() |
Modifier and Type | Method and Description |
---|---|
void |
clearBufferObjectState()
Clears out the known/unknown state of the various buffer object
binding states.
|
int |
getBoundBufferObject(int target,
GL caller)
Note: returns an unspecified value if the binding for the
specified target (e.g.
|
boolean |
isBoundBufferObjectKnown(int target)
Indicates whether the binding state for the specified target is
currently known.
|
void |
setBoundBufferObject(int target,
int buffer) |
public void setBoundBufferObject(int target, int buffer)
public int getBoundBufferObject(int target, GL caller)
public boolean isBoundBufferObjectKnown(int target)
public void clearBufferObjectState()
Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.