Package com.jme3.system.lwjgl
Class LwjglCanvas
java.lang.Object
com.jme3.system.lwjgl.LwjglContext
com.jme3.system.lwjgl.LwjglAbstractDisplay
com.jme3.system.lwjgl.LwjglCanvas
- All Implemented Interfaces:
JmeCanvasContext,JmeContext,Runnable
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.jme3.system.JmeContext
JmeContext.Type -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intprotected static final intprotected static final intprotected static final intprotected static final booleanFields inherited from class com.jme3.system.lwjgl.LwjglAbstractDisplay
allowSwapBuffers, autoFlush, frameRate, needClose, wasActiveFields inherited from class com.jme3.system.lwjgl.LwjglContext
clContext, clPlatform, created, createdLock, joyInput, keyInput, listener, mouseInput, renderable, renderer, settings, THREAD_NAME, timer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.lwjgl.opengl.PixelFormatacquirePixelFormat(boolean forPbuffer) It seems it is best to use one pixel format for all shared contexts.voidcreate(boolean waitFor) Creates the context and makes it active.protected voidcreateContext(AppSettings settings) This is called: 1) When the context thread starts 2) Any time the canvas becomes displayable again.protected voidThis is called: 1) When the context thread ends 2) Any time the canvas becomes non-displayableprotected voidgetType()protected voidMakes sure the pbuffer is available and ready for usevoidrestart()Restart if it's a windowed or full-screen display.protected voidrunLoop()execute one iteration of the render loop in the OpenGL threadvoidSet the title if it's a windowed displayMethods inherited from class com.jme3.system.lwjgl.LwjglAbstractDisplay
checkGLError, deinitInThread, destroy, getJoyInput, getKeyInput, getMouseInput, getTouchInput, initInThread, run, setAutoFlushFramesMethods inherited from class com.jme3.system.lwjgl.LwjglContext
create, createContextAttribs, destroy, determineMaxSamples, getFramebufferHeight, getFramebufferWidth, getGLVersion, getNumSamplesToUse, getOpenCLContext, getRenderer, getSettings, getSystemListener, getTimer, getWindowXPosition, getWindowYPosition, initContextFirstTime, initOpenCL, internalCreate, internalDestroy, isCreated, isRenderable, loadNatives, printContextInitInfo, 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
destroy, getFramebufferHeight, getFramebufferWidth, getJoyInput, getKeyInput, getMouseInput, getOpenCLContext, getRenderer, getSettings, getSystemListener, getTimer, getTouchInput, getWindowXPosition, getWindowYPosition, isCreated, isRenderable, setAutoFlushFrames, setSettings, setSystemListener
-
Field Details
-
TASK_NOTHING
protected static final int TASK_NOTHING- See Also:
-
TASK_DESTROY_DISPLAY
protected static final int TASK_DESTROY_DISPLAY- See Also:
-
TASK_CREATE_DISPLAY
protected static final int TASK_CREATE_DISPLAY- See Also:
-
TASK_COMPLETE
protected static final int TASK_COMPLETE- See Also:
-
USE_SHARED_CONTEXT
protected static final boolean USE_SHARED_CONTEXT- See Also:
-
-
Constructor Details
-
LwjglCanvas
public LwjglCanvas()
-
-
Method Details
-
getType
- Specified by:
getTypein interfaceJmeContext- Specified by:
getTypein classLwjglAbstractDisplay- Returns:
- Type.Display or Type.Canvas
-
create
public void create(boolean waitFor) Description copied from interface:JmeContextCreates the context and makes it active.- Specified by:
createin interfaceJmeContext- Parameters:
waitFor- If true, will wait until context has initialized.
-
setTitle
Description copied from class:LwjglAbstractDisplaySet the title if it's a windowed display- Specified by:
setTitlein interfaceJmeContext- Specified by:
setTitlein classLwjglAbstractDisplay- Parameters:
title- the desired title
-
restart
public void restart()Description copied from class:LwjglAbstractDisplayRestart if it's a windowed or full-screen display.- Specified by:
restartin interfaceJmeContext- Specified by:
restartin classLwjglAbstractDisplay
-
getCanvas
- Specified by:
getCanvasin interfaceJmeCanvasContext
-
runLoop
protected void runLoop()Description copied from class:LwjglAbstractDisplayexecute one iteration of the render loop in the OpenGL thread- Overrides:
runLoopin classLwjglAbstractDisplay
-
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.LWJGLExceptionMakes 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:
destroyContextin classLwjglAbstractDisplay
-
createContext
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:
createContextin classLwjglAbstractDisplay- Parameters:
settings- the AppSettings to apply
-