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
Modifier and TypeFieldDescriptionprotected static final int
protected static final int
protected static final int
protected static final int
protected static final boolean
Fields inherited from class com.jme3.system.lwjgl.LwjglAbstractDisplay
allowSwapBuffers, autoFlush, frameRate, needClose, wasActive
Fields inherited from class com.jme3.system.lwjgl.LwjglContext
clContext, clPlatform, created, createdLock, joyInput, keyInput, listener, mouseInput, renderable, renderer, settings, THREAD_NAME, timer
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected org.lwjgl.opengl.PixelFormat
acquirePixelFormat
(boolean forPbuffer) It seems it is best to use one pixel format for all shared contexts.void
create
(boolean waitFor) Creates the context and makes it active.protected void
createContext
(AppSettings settings) This is called: 1) When the context thread starts 2) Any time the canvas becomes displayable again.protected void
This is called: 1) When the context thread ends 2) Any time the canvas becomes non-displayableprotected void
getType()
protected void
Makes sure the pbuffer is available and ready for usevoid
restart()
Restart if it's a windowed or full-screen display.protected void
runLoop()
execute one iteration of the render loop in the OpenGL threadvoid
Set 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, setAutoFlushFrames
Methods 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, 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
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:
getType
in interfaceJmeContext
- Specified by:
getType
in classLwjglAbstractDisplay
- Returns:
- Type.Display or Type.Canvas
-
create
public void create(boolean waitFor) Description copied from interface:JmeContext
Creates the context and makes it active.- Specified by:
create
in interfaceJmeContext
- Parameters:
waitFor
- If true, will wait until context has initialized.
-
setTitle
Description copied from class:LwjglAbstractDisplay
Set the title if it's a windowed display- Specified by:
setTitle
in interfaceJmeContext
- Specified by:
setTitle
in classLwjglAbstractDisplay
- Parameters:
title
- the desired title
-
restart
public void restart()Description copied from class:LwjglAbstractDisplay
Restart if it's a windowed or full-screen display.- Specified by:
restart
in interfaceJmeContext
- Specified by:
restart
in classLwjglAbstractDisplay
-
getCanvas
- Specified by:
getCanvas
in interfaceJmeCanvasContext
-
runLoop
protected void runLoop()Description copied from class:LwjglAbstractDisplay
execute one iteration of the render loop in the OpenGL thread- Overrides:
runLoop
in 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:
destroyContext
in 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:
createContext
in classLwjglAbstractDisplay
- Parameters:
settings
- the AppSettings to apply
-