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
FieldsModifier and TypeFieldDescriptionstatic booleanSet totrueto enable deletion of native buffers together with GL objects when requested. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteAllObjects(Object rendererObject) (Internal use only) Deletes all objects.voiddeleteUnused(Object rendererObject) (Internal use only) Deletes unused NativeObjects.void(Internal use only) Register aNativeObjectwith the manager.void(Internal use only) Resets allNativeObjects.
-
Field Details
-
UNSAFE
public static boolean UNSAFESet totrueto 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 aNativeObjectwith the manager.- Parameters:
obj- the object to register (not null)
-
deleteUnused
(Internal use only) Deletes unused NativeObjects. Will delete at mostMAX_REMOVES_PER_FRAMEobjects.- Parameters:
rendererObject- The renderer object. For graphics objects,Rendereris 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 allNativeObjects. This is typically called when the context is restarted.
-