Class GLFence

java.lang.Object
com.jme3.util.NativeObject
com.jme3.renderer.opengl.GLFence
All Implemented Interfaces:
Cloneable

public class GLFence extends NativeObject
Wrapper for an OpenGL sync object (fence).

See here.

A fence is a synchronization primitive that can be used to coordinate work between the CPU and GPU. Once inserted into the command stream, the GPU will signal the fence when all preceding commands have completed.

This class wraps the native sync handle (either a long address or a GLSync)

See Also:
  • Constructor Details

    • GLFence

      public GLFence(long fenceId, Object nativeSync)
      Creates a new fence wrapper with the given handle and native sync object.
      Parameters:
      fenceId - the native sync object handle (pointer)
      nativeSync - the backend-specific sync object (e.g., LWJGL2's GLSync) or null
  • Method Details

    • getNativeSync

      public Object getNativeSync()
      Returns the backend-specific native sync object, if set.

      This is used by LWJGL2 that require their own GLSync object type rather than a raw pointer.

      Returns:
      the native sync object, or null if not set
    • getFenceId

      public long getFenceId()
    • resetObject

      public void resetObject()
      Description copied from class: NativeObject
      Called when the GL context is restarted to reset all IDs. Prevents "white textures" on display restart.
      Specified by:
      resetObject in class NativeObject
    • deleteObject

      public void deleteObject(Object rendererObject)
      Description copied from class: NativeObject
      Deletes the GL object from the GPU when it is no longer used. Called automatically by the GL object manager.
      Specified by:
      deleteObject in class NativeObject
      Parameters:
      rendererObject - The renderer to be used to delete the object
    • createDestructableClone

      public NativeObject createDestructableClone()
      Description copied from class: NativeObject
      Creates a shallow clone of this GL Object. The deleteObject method should be functional for this object.
      Specified by:
      createDestructableClone in class NativeObject
      Returns:
      a new instance
    • getUniqueId

      public long getUniqueId()
      Description copied from class: NativeObject
      Returns a unique ID for this NativeObject. No other NativeObject shall have the same ID.
      Specified by:
      getUniqueId in class NativeObject
      Returns:
      unique ID for this NativeObject.