Package com.jme3.util
Class NativeObjectManager
java.lang.Object
com.jme3.util.NativeObjectManager
GLObjectManager tracks all GLObjects used by the Renderer. Using a
ReferenceQueue
the GLObjectManager
can delete
unused objects from GPU when their counterparts on the CPU are no longer used.
On restart, the renderer may request the objects to be reset, thus allowing
the GLObjects to re-initialize with the new display context.-
Field Summary
Modifier and TypeFieldDescriptionstatic boolean
Set totrue
to enable deletion of native buffers together with GL objects when requested. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
deleteAllObjects
(Object rendererObject) (Internal use only) Deletes all objects.void
deleteUnused
(Object rendererObject) (Internal use only) Deletes unused NativeObjects.void
(Internal use only) Register aNativeObject
with the manager.void
(Internal use only) Resets allNativeObject
s.
-
Field Details
-
UNSAFE
public static boolean UNSAFESet totrue
to enable deletion of native buffers together with GL objects when requested. Note that usage of object after deletion could cause undefined results or native crashes, therefore by default this is set tofalse
.
-
-
Constructor Details
-
NativeObjectManager
public NativeObjectManager()
-
-
Method Details
-
registerObject
(Internal use only) Register aNativeObject
with the manager.- Parameters:
obj
- the object to register (not null)
-
deleteUnused
(Internal use only) Deletes unused NativeObjects. Will delete at mostMAX_REMOVES_PER_FRAME
objects.- Parameters:
rendererObject
- The renderer object. For graphics objects,Renderer
is used, for audio, {#link AudioRenderer} is used.
-
deleteAllObjects
(Internal use only) Deletes all objects. Must only be called when display is destroyed.- Parameters:
rendererObject
- the renderer object
-
resetObjects
public void resetObjects()(Internal use only) Resets allNativeObject
s. This is typically called when the context is restarted.
-