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:
com.jme3.system.JmeCanvasContext,com.jme3.system.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);
...
- Author:
- wil
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.jme3.system.JmeContext
com.jme3.system.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(com.jme3.system.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)com.jme3.input.KeyInput(non-Javadoc)com.jme3.input.MouseInput(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(com.jme3.system.AppSettings settings) (non-Javadoc)protected void(non-Javadoc)Methods inherited from class com.jme3.system.lwjgl.LwjglWindow
deinitInThread, getJoyInput, 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
getJoyInput, getOpenCLContext, 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:
destroyin interfacecom.jme3.system.JmeContext- Overrides:
destroyin classLwjglWindow- Parameters:
waitFor- boolean- See Also:
-
JmeContext.destroy(boolean)
-
create
public void create(boolean waitFor) (non-Javadoc)- Specified by:
createin interfacecom.jme3.system.JmeContext- Overrides:
createin classLwjglWindow- Parameters:
waitFor- boolean- See Also:
-
JmeContext.create(boolean)
-
createContext
protected void createContext(com.jme3.system.AppSettings settings) (non-Javadoc)- Overrides:
createContextin classLwjglWindow- Parameters:
settings- AAppSettingsobject- See Also:
-
getCanvas
Returns the AWT component where it is drawn (canvas).- Specified by:
getCanvasin interfacecom.jme3.system.JmeCanvasContext- Returns:
- Canvas
-
showWindow
protected void showWindow()(non-Javadoc)- Overrides:
showWindowin classLwjglWindow
-
setWindowIcon
protected void setWindowIcon(com.jme3.system.AppSettings settings) (non-Javadoc)- Overrides:
setWindowIconin classLwjglWindow- Parameters:
settings- settings for getting the icons
-
setTitle
(non-Javadoc)- Specified by:
setTitlein interfacecom.jme3.system.JmeContext- Overrides:
setTitlein classLwjglWindow- Parameters:
title- the title to set
-
getKeyInput
public com.jme3.input.KeyInput getKeyInput()(non-Javadoc)- Specified by:
getKeyInputin interfacecom.jme3.system.JmeContext- Overrides:
getKeyInputin classLwjglWindow- Returns:
- returns a
AwtKeyInputobject - See Also:
-
getMouseInput
public com.jme3.input.MouseInput getMouseInput()(non-Javadoc)- Specified by:
getMouseInputin interfacecom.jme3.system.JmeContext- 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 interfacecom.jme3.system.JmeContext- Overrides:
getFramebufferHeightin classLwjglWindow- Returns:
- int
- See Also:
-
getFramebufferWidth
public int getFramebufferWidth()(non-Javadoc)- Specified by:
getFramebufferWidthin interfacecom.jme3.system.JmeContext- Overrides:
getFramebufferWidthin classLwjglWindow- Returns:
- int
- See Also:
-