Package com.jme3.util

Class NativeObjectManager


public class NativeObjectManager extends Object
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 Details

    • UNSAFE

      public static boolean UNSAFE
      Set to true 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 to false.
  • Constructor Details

    • NativeObjectManager

      public NativeObjectManager()
  • Method Details

    • registerObject

      public void registerObject(NativeObject obj)
      (Internal use only) Register a NativeObject with the manager.
      obj - the object to register (not null)
    • deleteUnused

      public void deleteUnused(Object rendererObject)
      (Internal use only) Deletes unused NativeObjects. Will delete at most MAX_REMOVES_PER_FRAME objects.
      rendererObject - The renderer object. For graphics objects, Renderer is used, for audio, {#link AudioRenderer} is used.
    • deleteAllObjects

      public void deleteAllObjects(Object rendererObject)
      (Internal use only) Deletes all objects. Must only be called when display is destroyed.
      rendererObject - the renderer object
    • resetObjects

      public void resetObjects()
      (Internal use only) Resets all NativeObjects. This is typically called when the context is restarted.