Package com.jme3.system.lwjgl
Class LwjglCanvas
java.lang.Object
com.jme3.system.lwjgl.LwjglContext
com.jme3.system.lwjgl.LwjglWindow
com.jme3.system.lwjgl.LwjglCanvas
- All Implemented Interfaces:
JmeCanvasContext
,JmeContext
,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);
...
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.jme3.system.JmeContext
JmeContext.Type
-
Field Summary
Fields inherited from class com.jme3.system.lwjgl.LwjglWindow
allowSwapBuffers, autoFlush, needClose, needRestart, wasActive
Fields inherited from class com.jme3.system.lwjgl.LwjglContext
CL_GL_SHARING_POSSIBLE, clContext, created, createdLock, joyInput, listener, renderable, renderer, settings, timer
-
Constructor Summary
ConstructorsConstructorDescriptionGenerate a new OpenGL context (LwjglCanvas
) to integrate AWT/Swing with JME3 in your desktop applications. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Check if the canvas is displayed, that is, if it has a parent that has set it up.void
create
(boolean waitFor) (non-Javadoc)protected void
createContext
(AppSettings settings) (non-Javadoc)void
destroy
(boolean waitFor) (non-Javadoc)protected void
(non-Javadoc)Returns the AWT component where it is drawn (canvas).int
(non-Javadoc)int
(non-Javadoc)(non-Javadoc)(non-Javadoc)protected String
getPrintContextInitInfo
(org.lwjgl.opengl.awt.GLData glData) Returns a string with the information obtained fromGLData
so that it can be displayed.protected void
(non-Javadoc)protected void
runLoop()
(non-Javadoc)void
(non-Javadoc)protected void
setWindowIcon
(AppSettings settings) (non-Javadoc)protected void
(non-Javadoc)Methods inherited from class com.jme3.system.lwjgl.LwjglWindow
deinitInThread, getDisplays, getJoyInput, getPrimaryDisplay, getTouchInput, getType, getWindowContentScale, getWindowHandle, getWindowXPosition, getWindowYPosition, initInThread, registerWindowSizeListener, removeWindowSizeListener, restart, run, setAutoFlushFrames
Methods inherited from class com.jme3.system.lwjgl.LwjglContext
create, destroy, determineMaxSamples, getNumSamplesToUse, getOpenCLContext, getRenderer, getSettings, getSystemListener, getTimer, initContextFirstTime, initOpenCL, internalCreate, internalDestroy, isCreated, isRenderable, reinitContext, setSettings, setSystemListener, waitFor
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.jme3.system.JmeContext
getDisplays, getJoyInput, getOpenCLContext, getPrimaryDisplay, getRenderer, getSettings, getSystemListener, getTimer, getTouchInput, getType, getWindowXPosition, getWindowYPosition, isCreated, isRenderable, restart, setAutoFlushFrames, setSettings, setSystemListener
-
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 interfaceJmeContext
- Overrides:
destroy
in classLwjglWindow
- Parameters:
waitFor
- boolean- See Also:
-
create
public void create(boolean waitFor) (non-Javadoc)- Specified by:
create
in interfaceJmeContext
- Overrides:
create
in classLwjglWindow
- Parameters:
waitFor
- boolean- See Also:
-
createContext
(non-Javadoc)- Overrides:
createContext
in classLwjglWindow
- Parameters:
settings
- AAppSettings
object- See Also:
-
getCanvas
Returns the AWT component where it is drawn (canvas).- Specified by:
getCanvas
in interfaceJmeCanvasContext
- Returns:
- Canvas
-
showWindow
protected void showWindow()(non-Javadoc)- Overrides:
showWindow
in classLwjglWindow
-
setWindowIcon
(non-Javadoc)- Overrides:
setWindowIcon
in classLwjglWindow
- Parameters:
settings
- settings for getting the icons
-
setTitle
(non-Javadoc)- Specified by:
setTitle
in interfaceJmeContext
- Overrides:
setTitle
in classLwjglWindow
- Parameters:
title
- the title to set
-
getKeyInput
(non-Javadoc)- Specified by:
getKeyInput
in interfaceJmeContext
- Overrides:
getKeyInput
in classLwjglWindow
- Returns:
- returns a
AwtKeyInput
object - See Also:
-
getMouseInput
(non-Javadoc)- Specified by:
getMouseInput
in interfaceJmeContext
- Overrides:
getMouseInput
in classLwjglWindow
- 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 returnsfalse
-
destroyContext
protected void destroyContext()(non-Javadoc)- Overrides:
destroyContext
in classLwjglWindow
- See Also:
-
runLoop
protected void runLoop()(non-Javadoc)- Overrides:
runLoop
in classLwjglWindow
- See Also:
-
printContextInitInfo
protected void printContextInitInfo()(non-Javadoc)- Overrides:
printContextInitInfo
in classLwjglContext
- See Also:
-
getPrintContextInitInfo
Returns a string with the information obtained fromGLData
so that it can be displayed.- Parameters:
glData
- context information- Returns:
- String
-
getFramebufferHeight
public int getFramebufferHeight()(non-Javadoc)- Specified by:
getFramebufferHeight
in interfaceJmeContext
- Overrides:
getFramebufferHeight
in classLwjglWindow
- Returns:
- int
- See Also:
-
getFramebufferWidth
public int getFramebufferWidth()(non-Javadoc)- Specified by:
getFramebufferWidth
in interfaceJmeContext
- Overrides:
getFramebufferWidth
in classLwjglWindow
- Returns:
- int
- See Also:
-