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, wasActiveFields 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 TypeMethodDescriptionbooleanCheck if the canvas is displayed, that is, if it has a parent that has set it up.voidcreate(boolean waitFor) (non-Javadoc)protected voidcreateContext(AppSettings settings) (non-Javadoc)voiddestroy(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 StringgetPrintContextInitInfo(org.lwjgl.opengl.awt.GLData glData) Returns a string with the information obtained fromGLDataso that it can be displayed.protected void(non-Javadoc)protected voidrunLoop()(non-Javadoc)void(non-Javadoc)protected voidsetWindowIcon(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, setAutoFlushFramesMethods 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, waitForMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.jme3.system.JmeContext
getDisplays, getJoyInput, getOpenCLContext, getPrimaryDisplay, getRenderer, getSettings, getSystemListener, getTimer, getTouchInput, getType, getWindowXPosition, getWindowYPosition, isCreated, isRenderable, onRenderManagerReady, 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:
destroyin interfaceJmeContext- Overrides:
destroyin classLwjglWindow- Parameters:
waitFor- boolean- See Also:
-
create
public void create(boolean waitFor) (non-Javadoc)- Specified by:
createin interfaceJmeContext- Overrides:
createin classLwjglWindow- Parameters:
waitFor- boolean- See Also:
-
createContext
(non-Javadoc)- Overrides:
createContextin classLwjglWindow- Parameters:
settings- AAppSettingsobject- See Also:
-
getCanvas
Returns the AWT component where it is drawn (canvas).- Specified by:
getCanvasin interfaceJmeCanvasContext- Returns:
- Canvas
-
showWindow
protected void showWindow()(non-Javadoc)- Overrides:
showWindowin classLwjglWindow
-
setWindowIcon
(non-Javadoc)- Overrides:
setWindowIconin classLwjglWindow- Parameters:
settings- settings for getting the icons
-
setTitle
(non-Javadoc)- Specified by:
setTitlein interfaceJmeContext- Overrides:
setTitlein classLwjglWindow- Parameters:
title- the title to set
-
getKeyInput
(non-Javadoc)- Specified by:
getKeyInputin interfaceJmeContext- Overrides:
getKeyInputin classLwjglWindow- Returns:
- returns a
AwtKeyInputobject - See Also:
-
getMouseInput
(non-Javadoc)- Specified by:
getMouseInputin interfaceJmeContext- Overrides:
getMouseInputin classLwjglWindow- Returns:
- returns a
AwtMouseInputobject - 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
trueif the canvas is ready to draw; otherwise returnsfalse
-
destroyContext
protected void destroyContext()(non-Javadoc)- Overrides:
destroyContextin classLwjglWindow- See Also:
-
runLoop
protected void runLoop()(non-Javadoc)- Overrides:
runLoopin classLwjglWindow- See Also:
-
printContextInitInfo
protected void printContextInitInfo()(non-Javadoc)- Overrides:
printContextInitInfoin classLwjglContext- See Also:
-
getPrintContextInitInfo
Returns a string with the information obtained fromGLDataso that it can be displayed.- Parameters:
glData- context information- Returns:
- String
-
getFramebufferHeight
public int getFramebufferHeight()(non-Javadoc)- Specified by:
getFramebufferHeightin interfaceJmeContext- Overrides:
getFramebufferHeightin classLwjglWindow- Returns:
- int
- See Also:
-
getFramebufferWidth
public int getFramebufferWidth()(non-Javadoc)- Specified by:
getFramebufferWidthin interfaceJmeContext- Overrides:
getFramebufferWidthin classLwjglWindow- Returns:
- int
- See Also:
-