org.scilab.forge.scirenderer.implementation.jogl.buffers
Class JoGLBuffersManager

java.lang.Object
  extended by org.scilab.forge.scirenderer.implementation.jogl.buffers.JoGLBuffersManager
All Implemented Interfaces:
BuffersManager

public final class JoGLBuffersManager
extends java.lang.Object
implements BuffersManager

Author:
Pierre Lando

Constructor Summary
JoGLBuffersManager()
          Default constructor.
 
Method Summary
 int bindColorsBuffer(GL2 gl, ElementsBuffer buffer)
          Bind the given buffer as color buffer.
 int bindIndicesBuffer(GL2 gl, IndicesBuffer buffer)
          Bind the given buffer as indices buffer.
 int bindNormalsBuffer(GL2 gl, ElementsBuffer buffer)
          Bind the given buffer as normal buffer.
 int bindTextureCoordinatesBuffer(GL2 gl, ElementsBuffer buffer)
          Bind the given buffer as texture coordinate buffer.
 int bindVertexBuffer(GL2 gl, ElementsBuffer buffer)
          Bind the given buffer as vertex buffer.
 ElementsBuffer createElementsBuffer()
          Create an elements buffer.
 IndicesBuffer createIndicesBuffer()
          Create an indices buffer.
 void dispose(java.util.Collection<? extends DataBuffer> buffers)
          Release all resources used by the given buffers.
 void dispose(DataBuffer buffer)
          Release all resources used by the given buffer.
 void glReload()
          Called when previous OpenGl context is gone.
 void glSynchronize(GL2 gl)
          Called before rendering for synchronisation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JoGLBuffersManager

public JoGLBuffersManager()
Default constructor.

Method Detail

createElementsBuffer

public ElementsBuffer createElementsBuffer()
Description copied from interface: BuffersManager
Create an elements buffer.

Specified by:
createElementsBuffer in interface BuffersManager
Returns:
a new elements buffer.

createIndicesBuffer

public IndicesBuffer createIndicesBuffer()
Description copied from interface: BuffersManager
Create an indices buffer.

Specified by:
createIndicesBuffer in interface BuffersManager
Returns:
a new indices buffer.

dispose

public void dispose(DataBuffer buffer)
Description copied from interface: BuffersManager
Release all resources used by the given buffer.

Specified by:
dispose in interface BuffersManager
Parameters:
buffer - the given buffer.

dispose

public void dispose(java.util.Collection<? extends DataBuffer> buffers)
Description copied from interface: BuffersManager
Release all resources used by the given buffers.

Specified by:
dispose in interface BuffersManager
Parameters:
buffers - the given buffers.

glReload

public void glReload()
Called when previous OpenGl context is gone.


glSynchronize

public void glSynchronize(GL2 gl)
Called before rendering for synchronisation. Clean dead buffers.

Parameters:
gl - the OpenGl context.

bindVertexBuffer

public int bindVertexBuffer(GL2 gl,
                            ElementsBuffer buffer)
Bind the given buffer as vertex buffer.

Parameters:
gl - the OpenGl context where the buffer is bind.
buffer - the buffer to bind.
Returns:
the number of element actually bind.

bindNormalsBuffer

public int bindNormalsBuffer(GL2 gl,
                             ElementsBuffer buffer)
Bind the given buffer as normal buffer.

Parameters:
gl - the OpenGl context where the buffer is bind.
buffer - the buffer to bind.
Returns:
the number of element actually bind.

bindTextureCoordinatesBuffer

public int bindTextureCoordinatesBuffer(GL2 gl,
                                        ElementsBuffer buffer)
Bind the given buffer as texture coordinate buffer.

Parameters:
gl - the OpenGl context where the buffer is bind.
buffer - the buffer to bind.
Returns:
the number of element actually bind.

bindColorsBuffer

public int bindColorsBuffer(GL2 gl,
                            ElementsBuffer buffer)
Bind the given buffer as color buffer.

Parameters:
gl - the OpenGl context where the buffer is bind.
buffer - the buffer to bind.
Returns:
the number of element actually bind.

bindIndicesBuffer

public int bindIndicesBuffer(GL2 gl,
                             IndicesBuffer buffer)
Bind the given buffer as indices buffer.

Parameters:
gl - the OpenGl context where the buffer is bind.
buffer - the buffer to bind.
Returns:
the number of element actually bind.