de.javagl.simplerenderer.lwjgl
Class SimpleRendererLWJGL

java.lang.Object
  extended by de.javagl.simplerenderer.AbstractSimpleRenderer
      extended by de.javagl.simplerenderer.lwjgl.SimpleRendererLWJGL
All Implemented Interfaces:
SimpleRenderer

public class SimpleRendererLWJGL
extends AbstractSimpleRenderer
implements SimpleRenderer

Implementation of a SimpleRenderer using LWJGL


Field Summary
 
Fields inherited from class de.javagl.simplerenderer.AbstractSimpleRenderer
FRAGMENT_SHADER_SOURCE, VERTEX_SHADER_SOURCE
 
Fields inherited from interface de.javagl.simplerenderer.SimpleRenderer
CL_CGL_SHAREGROUP_KHR, CL_EGL_DISPLAY_KHR, CL_GL_CONTEXT_KHR, CL_GLX_DISPLAY_KHR, CL_WGL_HDC_KHR
 
Constructor Summary
SimpleRendererLWJGL()
          Creates a new SimpleRendererLWJGL
 
Method Summary
 java.nio.FloatBuffer acquireBuffer(int vbo)
          Map the buffer for the specified vertex buffer object
protected  SimpleObjectGL addSimpleObjectInternal(SimpleObject simpleObject)
          Will be called on the rendering thread to add the given SimpleObject.
 long[] getCLContextProperties()
          Return the OpenCL context properties for the OpenGL context that is backing this renderer.
 java.awt.Component getRenderComponent()
          Returns the component that is used for rendering
protected  void initGL()
          Initialize the shaders and the shader program
protected  void postRender()
          Will be called immediately after rendering the objects
protected  void preRender()
          Will be called immediately before rendering the objects
 void releaseBuffer(int vbo)
          Unmap the buffer for the specified vertex buffer object
protected  SimpleObjectGL removeSimpleObjectInternal(SimpleObject simpleObject)
          Will be called on the rendering thread to release the given SimpleObject.
protected  void render(SimpleObject simpleObject)
          Render the given object
protected  void setupView()
          Set up the viewport depending on the size of the rendering component.
static java.nio.ByteBuffer toByteBuffer(java.lang.String s)
          Converts the given String into a 0-terminated, direct byte buffer.
 
Methods inherited from class de.javagl.simplerenderer.AbstractSimpleRenderer
addPostRenderCallback, addPreRenderCallback, addSimpleObject, clearSimpleObjects, getModelviewMatrix, getProjectionMatrix, getRenderingSemaphore, getSimpleObjectGL, getSimpleObjects, internalInitialization, invokeLater, processPostRenderCallbacks, processPreRenderCallbacks, processTasks, removePostRenderCallback, removePreRenderCallback, removeSimpleObject, render, updateProjectionMatrix
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.javagl.simplerenderer.SimpleRenderer
addPostRenderCallback, addPreRenderCallback, addSimpleObject, clearSimpleObjects, getRenderingSemaphore, getSimpleObjectGL, getSimpleObjects, invokeLater, removePostRenderCallback, removePreRenderCallback, removeSimpleObject
 

Constructor Detail

SimpleRendererLWJGL

public SimpleRendererLWJGL()
Creates a new SimpleRendererLWJGL

Method Detail

getRenderComponent

public java.awt.Component getRenderComponent()
Description copied from interface: SimpleRenderer
Returns the component that is used for rendering

Specified by:
getRenderComponent in interface SimpleRenderer
Returns:
The component that is used for rendering

setupView

protected void setupView()
Description copied from class: AbstractSimpleRenderer
Set up the viewport depending on the size of the rendering component. Will be called at the beginning of the rendering pass.

Specified by:
setupView in class AbstractSimpleRenderer

toByteBuffer

public static java.nio.ByteBuffer toByteBuffer(java.lang.String s)
Converts the given String into a 0-terminated, direct byte buffer.

Parameters:
s - The input String
Returns:
The byte buffer

initGL

protected void initGL()
Initialize the shaders and the shader program


preRender

protected void preRender()
Description copied from class: AbstractSimpleRenderer
Will be called immediately before rendering the objects

Overrides:
preRender in class AbstractSimpleRenderer

render

protected void render(SimpleObject simpleObject)
Description copied from class: AbstractSimpleRenderer
Render the given object

Specified by:
render in class AbstractSimpleRenderer
Parameters:
simpleObject - The object to render

postRender

protected void postRender()
Description copied from class: AbstractSimpleRenderer
Will be called immediately after rendering the objects

Overrides:
postRender in class AbstractSimpleRenderer

addSimpleObjectInternal

protected SimpleObjectGL addSimpleObjectInternal(SimpleObject simpleObject)
Description copied from class: AbstractSimpleRenderer
Will be called on the rendering thread to add the given SimpleObject.

Specified by:
addSimpleObjectInternal in class AbstractSimpleRenderer
Parameters:
simpleObject - The SimpleObject to add
Returns:
The SimpleObjectGL

removeSimpleObjectInternal

protected SimpleObjectGL removeSimpleObjectInternal(SimpleObject simpleObject)
Description copied from class: AbstractSimpleRenderer
Will be called on the rendering thread to release the given SimpleObject.

Specified by:
removeSimpleObjectInternal in class AbstractSimpleRenderer
Parameters:
simpleObject - The SimpleObject to remove
Returns:
The SimpleObjectGL

getCLContextProperties

public long[] getCLContextProperties()
Description copied from interface: SimpleRenderer
Return the OpenCL context properties for the OpenGL context that is backing this renderer.

Specified by:
getCLContextProperties in interface SimpleRenderer
Returns:
The OpenCL context properties

acquireBuffer

public java.nio.FloatBuffer acquireBuffer(int vbo)
Description copied from interface: SimpleRenderer
Map the buffer for the specified vertex buffer object

Specified by:
acquireBuffer in interface SimpleRenderer
Parameters:
vbo - The VBO identifier
Returns:
The mapped buffer

releaseBuffer

public void releaseBuffer(int vbo)
Description copied from interface: SimpleRenderer
Unmap the buffer for the specified vertex buffer object

Specified by:
releaseBuffer in interface SimpleRenderer
Parameters:
vbo - The VBO identifier