Class LwjglCanvas

All Implemented Interfaces:
com.jme3.system.JmeCanvasContext, com.jme3.system.JmeContext, Runnable

public class LwjglCanvas extends LwjglWindow implements com.jme3.system.JmeCanvasContext, Runnable
Class LwjglCanvas that integrates LWJGLX which allows using AWT-Swing components.

If LwjglCanvas throws an exception due to configuration problems, we can debug as follows:
- In AppSettings, set this property to enable a debug that displays the effective data for the context.


 ....
  AppSettings settings = new AppSettings(true);
  settings.putBoolean("GLDataEffectiveDebug", true);
 ...
 

NOTE: If running LwjglCanvas on older machines, the SRGB | Gamma Correction option will raise an exception, so it should be disabled.


 ....
  AppSettings settings = new AppSettings(true);
  settings.setGammaCorrection(false);
 ...
 
Author:
wil
  • Constructor Details

    • LwjglCanvas

      public LwjglCanvas()
      Generate a new OpenGL context (LwjglCanvas) to integrate AWT/Swing with JME3 in your desktop applications.
  • Method Details

    • destroy

      public void destroy(boolean waitFor)
      (non-Javadoc)
      Specified by:
      destroy in interface com.jme3.system.JmeContext
      Overrides:
      destroy in class LwjglWindow
      Parameters:
      waitFor - boolean
      See Also:
      • JmeContext.destroy(boolean)
    • create

      public void create(boolean waitFor)
      (non-Javadoc)
      Specified by:
      create in interface com.jme3.system.JmeContext
      Overrides:
      create in class LwjglWindow
      Parameters:
      waitFor - boolean
      See Also:
      • JmeContext.create(boolean)
    • createContext

      protected void createContext(com.jme3.system.AppSettings settings)
      (non-Javadoc)
      Overrides:
      createContext in class LwjglWindow
      Parameters:
      settings - A AppSettings object
      See Also:
    • getCanvas

      public Canvas getCanvas()
      Returns the AWT component where it is drawn (canvas).
      Specified by:
      getCanvas in interface com.jme3.system.JmeCanvasContext
      Returns:
      Canvas
    • showWindow

      protected void showWindow()
      (non-Javadoc)
      Overrides:
      showWindow in class LwjglWindow
    • setWindowIcon

      protected void setWindowIcon(com.jme3.system.AppSettings settings)
      (non-Javadoc)
      Overrides:
      setWindowIcon in class LwjglWindow
      Parameters:
      settings - settings for getting the icons
    • setTitle

      public void setTitle(String title)
      (non-Javadoc)
      Specified by:
      setTitle in interface com.jme3.system.JmeContext
      Overrides:
      setTitle in class LwjglWindow
      Parameters:
      title - the title to set
    • getKeyInput

      public com.jme3.input.KeyInput getKeyInput()
      (non-Javadoc)
      Specified by:
      getKeyInput in interface com.jme3.system.JmeContext
      Overrides:
      getKeyInput in class LwjglWindow
      Returns:
      returns a AwtKeyInput object
      See Also:
    • getMouseInput

      public com.jme3.input.MouseInput getMouseInput()
      (non-Javadoc)
      Specified by:
      getMouseInput in interface com.jme3.system.JmeContext
      Overrides:
      getMouseInput in class LwjglWindow
      Returns:
      returns a AwtMouseInput object
      See Also:
    • checkVisibilityState

      public boolean checkVisibilityState()
      Check if the canvas is displayed, that is, if it has a parent that has set it up.

      It is very important that this verification be done so that LWJGL3-AWT works correctly.

      Returns:
      returns true if the canvas is ready to draw; otherwise returns false
    • destroyContext

      protected void destroyContext()
      (non-Javadoc)
      Overrides:
      destroyContext in class LwjglWindow
      See Also:
    • runLoop

      protected void runLoop()
      (non-Javadoc)
      Overrides:
      runLoop in class LwjglWindow
      See Also:
    • printContextInitInfo

      protected void printContextInitInfo()
      (non-Javadoc)
      Overrides:
      printContextInitInfo in class LwjglContext
      See Also:
    • getPrintContextInitInfo

      protected String getPrintContextInitInfo(org.lwjgl.opengl.awt.GLData glData)
      Returns a string with the information obtained from GLData so that it can be displayed.
      Parameters:
      glData - context information
      Returns:
      String
    • getFramebufferHeight

      public int getFramebufferHeight()
      (non-Javadoc)
      Specified by:
      getFramebufferHeight in interface com.jme3.system.JmeContext
      Overrides:
      getFramebufferHeight in class LwjglWindow
      Returns:
      int
      See Also:
    • getFramebufferWidth

      public int getFramebufferWidth()
      (non-Javadoc)
      Specified by:
      getFramebufferWidth in interface com.jme3.system.JmeContext
      Overrides:
      getFramebufferWidth in class LwjglWindow
      Returns:
      int
      See Also: