Class LwjglCanvas

All Implemented Interfaces:
JmeCanvasContext, JmeContext, Runnable

public class LwjglCanvas extends LwjglAbstractDisplay implements JmeCanvasContext
  • Field Details

  • Constructor Details

    • LwjglCanvas

      public LwjglCanvas()
  • Method Details

    • getType

      public JmeContext.Type getType()
      Specified by:
      getType in interface JmeContext
      Specified by:
      getType in class LwjglAbstractDisplay
      Returns:
      Type.Display or Type.Canvas
    • create

      public void create(boolean waitFor)
      Description copied from interface: JmeContext
      Creates the context and makes it active.
      Specified by:
      create in interface JmeContext
      Parameters:
      waitFor - If true, will wait until context has initialized.
    • setTitle

      public void setTitle(String title)
      Description copied from class: LwjglAbstractDisplay
      Set the title if it's a windowed display
      Specified by:
      setTitle in interface JmeContext
      Specified by:
      setTitle in class LwjglAbstractDisplay
      Parameters:
      title - the desired title
    • restart

      public void restart()
      Description copied from class: LwjglAbstractDisplay
      Restart if it's a windowed or full-screen display.
      Specified by:
      restart in interface JmeContext
      Specified by:
      restart in class LwjglAbstractDisplay
    • getCanvas

      public Canvas getCanvas()
      Specified by:
      getCanvas in interface JmeCanvasContext
    • runLoop

      protected void runLoop()
      Description copied from class: LwjglAbstractDisplay
      execute one iteration of the render loop in the OpenGL thread
      Overrides:
      runLoop in class LwjglAbstractDisplay
    • acquirePixelFormat

      protected org.lwjgl.opengl.PixelFormat acquirePixelFormat(boolean forPbuffer)
      It seems it is best to use one pixel format for all shared contexts.
      Parameters:
      forPbuffer - true→zero samples, false→correct number of samples
      Returns:
      a new instance
      See Also:
    • makePbufferAvailable

      protected void makePbufferAvailable() throws org.lwjgl.LWJGLException
      Makes sure the pbuffer is available and ready for use
      Throws:
      org.lwjgl.LWJGLException - if the buffer can't be made current
    • destroyPbuffer

      protected void destroyPbuffer()
    • destroyContext

      protected void destroyContext()
      This is called: 1) When the context thread ends 2) Any time the canvas becomes non-displayable
      Specified by:
      destroyContext in class LwjglAbstractDisplay
    • createContext

      protected void createContext(AppSettings settings)
      This is called: 1) When the context thread starts 2) Any time the canvas becomes displayable again. In the first call of this method, OpenGL context is not ready yet. Therefore, OpenCL context cannot be created. The second call of this method is done after "simpleInitApp" is called. Therefore, OpenCL won't be available in "simpleInitApp" if Canvas/Swing is used. To use OpenCL with Canvas/Swing, you need to use OpenCL in the rendering loop "simpleUpdate" and check for "context.getOpenCLContext()!=null".
      Specified by:
      createContext in class LwjglAbstractDisplay
      Parameters:
      settings - the AppSettings to apply