public abstract class NativeObject
extends java.lang.Object
implements java.lang.Cloneable
Modifier and Type | Field and Description |
---|---|
protected java.lang.Object |
handleRef
A reference to a "handle".
|
protected int |
id
The ID of the object, usually depends on its type.
|
static int |
INVALID_ID |
protected NativeObjectManager |
objectManager
The object manager to which this NativeObject is registered to.
|
protected static int |
OBJTYPE_AUDIOBUFFER |
protected static int |
OBJTYPE_AUDIOSTREAM |
protected static int |
OBJTYPE_BO |
protected static int |
OBJTYPE_FILTER |
protected static int |
OBJTYPE_FRAMEBUFFER |
protected static int |
OBJTYPE_SHADER |
protected static int |
OBJTYPE_SHADERSOURCE |
protected static int |
OBJTYPE_TEXTURE |
protected static int |
OBJTYPE_VERTEXBUFFER |
protected boolean |
updateNeeded
True if the data represented by this GLObject has been changed
and needs to be updated before used.
|
Modifier | Constructor and Description |
---|---|
|
NativeObject()
Creates a new GLObject.
|
protected |
NativeObject(int id)
Protected constructor that doesn't allocate handle ref.
|
Modifier and Type | Method and Description |
---|---|
void |
clearUpdateNeeded()
Internal use only.
|
protected NativeObject |
clone()
This should create a deep clone.
|
abstract NativeObject |
createDestructableClone()
Creates a shallow clone of this GL Object.
|
protected void |
deleteNativeBuffers()
Deletes any associated native
buffers . |
abstract void |
deleteObject(java.lang.Object rendererObject)
Deletes the GL object from the GPU when it is no longer used.
|
void |
dispose()
Reclaims native resources used by this NativeObject.
|
int |
getId() |
abstract long |
getUniqueId()
Returns a unique ID for this NativeObject.
|
boolean |
isUpdateNeeded()
Internal use only.
|
abstract void |
resetObject()
Called when the GL context is restarted to reset all IDs.
|
void |
setId(int id)
Sets the ID of the NativeObject.
|
void |
setUpdateNeeded()
Internal use only.
|
java.lang.String |
toString() |
public static final int INVALID_ID
protected static final int OBJTYPE_VERTEXBUFFER
protected static final int OBJTYPE_TEXTURE
protected static final int OBJTYPE_FRAMEBUFFER
protected static final int OBJTYPE_SHADER
protected static final int OBJTYPE_SHADERSOURCE
protected static final int OBJTYPE_AUDIOBUFFER
protected static final int OBJTYPE_AUDIOSTREAM
protected static final int OBJTYPE_FILTER
protected static final int OBJTYPE_BO
protected NativeObjectManager objectManager
protected int id
protected java.lang.Object handleRef
protected boolean updateNeeded
public NativeObject()
protected NativeObject(int id)
public void setId(int id)
id
- The ID to setpublic int getId()
public void setUpdateNeeded()
public void clearUpdateNeeded()
public boolean isUpdateNeeded()
setUpdateNeeded()
was called before.public java.lang.String toString()
toString
in class java.lang.Object
protected NativeObject clone()
clone
in class java.lang.Object
protected void deleteNativeBuffers()
buffers
.
This is necessary because it is unlikely that native buffers
will be garbage collected naturally (due to how GC works), therefore
the collection must be handled manually.
Only implementations that manage native buffers need to override
this method. Note that the behavior that occurs when a
deleted native buffer is used is not defined, therefore this
method is protectedpublic abstract void resetObject()
public abstract void deleteObject(java.lang.Object rendererObject)
rendererObject
- The renderer to be used to delete the objectpublic abstract NativeObject createDestructableClone()
public abstract long getUniqueId()
public void dispose()
NativeObjectManager.UNSAFE
is
set to true, in that case native buffers are also reclaimed which may
introduce instability.