public class DrawableVBO extends AbstractDrawable implements IGLBindedResource
DrawableVBO
is able to efficiently draw a large collection of
geometries.
The user must provide a loader that will be later called when the GL context
requires loading the VBO data in GPU memory.
The loader might freely make settings on the drawable as it is called with a
reference to the DrawableVBO
is will be loading data into.
One can separate data and appearance by setting geometry settings out of
loading process.
DrawableVBO shape1 = new DrawableVBO(new MemoryVBOLoader(getScatter(size)));
shape1.setGeometry(GL.GL_POINTS); shape1.setColor(Color.WHITE);Modifier and Type | Field and Description |
---|---|
protected int[] |
arrayName |
protected int |
byteOffset |
protected Color |
color |
protected int |
colorChannelNumber |
protected int |
dimensions |
protected int[] |
elementName |
protected int |
geometry |
protected boolean |
hasMountedOnce |
protected IGLLoader<DrawableVBO> |
loader |
protected int |
normalOffset |
protected int |
pointer |
protected Quality |
quality |
protected int |
size |
protected float |
width |
bbox, boundingBoxColor, boundingBoxDisplayed, displayed, hasListeners, legend, legendDisplayed, listeners, spaceTransformer, transform, transformBefore
Constructor and Description |
---|
DrawableVBO(IGLLoader<DrawableVBO> loader) |
Modifier and Type | Method and Description |
---|---|
void |
applyGeometryTransform(Transform transform) |
protected void |
configure(com.jogamp.opengl.GL gl) |
protected void |
doBindGL2(com.jogamp.opengl.GL gl) |
void |
doConfigure(int pointer,
int size) |
void |
doConfigure(int pointer,
int size,
int byteOffset,
int normalOffset,
int dimensions) |
protected void |
doDrawElements(com.jogamp.opengl.GL gl) |
void |
doLoadArrayFloatBuffer(com.jogamp.opengl.GL gl,
FloatBuffer vertices) |
void |
doLoadArrayFloatBuffer(com.jogamp.opengl.GL gl,
int vertexSize,
FloatBuffer vertices) |
void |
doLoadElementIntBuffer(com.jogamp.opengl.GL gl,
IntBuffer indices) |
void |
doLoadElementIntBuffer(com.jogamp.opengl.GL gl,
int indexSize,
IntBuffer indices) |
void |
doSetBoundingBox(BoundingBox3d bounds) |
void |
draw(com.jogamp.opengl.GL gl,
com.jogamp.opengl.glu.GLU glu,
Camera cam)
Call OpenGL2 routines for rendering the object.
|
Color |
getColor() |
int |
getGeometry() |
Quality |
getQuality() |
float |
getWidth() |
boolean |
hasMountedOnce()
Return true if mount(...) has been called at least one time
|
boolean |
isHasColorBuffer() |
void |
mount(com.jogamp.opengl.GL gl)
Mount resources to gl context
|
Rotator |
rotator() |
Rotator |
rotator(boolean start)
Returns a
Rotator that can let the VBO turn around Z axis centered at X=0,Y=0. |
void |
setColor(Color color) |
void |
setData(com.jogamp.opengl.GL2 gl,
IntBuffer indices,
FloatBuffer vertices,
BoundingBox3d bounds,
int pointer) |
void |
setData(com.jogamp.opengl.GL gl,
FloatVBO vbo)
To be called by the VBOBuilder
|
void |
setData(com.jogamp.opengl.GL gl,
IntBuffer indices,
FloatBuffer vertices,
BoundingBox3d bounds) |
void |
setGeometry(int geometry)
Set geometry, use: GL.GL_TRIANGLES (default) ...
|
void |
setHasColorBuffer(boolean hasColorBuffer) |
void |
setQuality(Quality quality) |
void |
setWidth(float width) |
void |
updateBounds() |
addDrawableListener, call, call, callWithAlphaFactor, colorGL2, colorGLES2, dispose, doDrawBounds, doTransform, fireDrawableChanged, fireDrawableChanged, getBarycentre, getBoundingBoxColor, getBounds, getDistance, getLegend, getLongestDistance, getShortestDistance, getSpaceTransformer, getTransform, getTransformBefore, hasLegend, isBoundingBoxDisplayed, isDisplayed, isLegendDisplayed, negative, removeDrawableListener, setBoundingBoxColor, setBoundingBoxDisplayed, setDisplayed, setLegend, setLegendDisplayed, setSpaceTransformer, setTransform, setTransformBefore, toString, toString, vertexGL2, vertexGLES2
protected int geometry
protected float width
protected Quality quality
protected int colorChannelNumber
protected IGLLoader<DrawableVBO> loader
protected int byteOffset
protected int normalOffset
protected int dimensions
protected int size
protected int pointer
protected int[] arrayName
protected int[] elementName
protected boolean hasMountedOnce
protected Color color
public DrawableVBO(IGLLoader<DrawableVBO> loader)
public boolean hasMountedOnce()
IGLBindedResource
hasMountedOnce
in interface IGLBindedResource
public void mount(com.jogamp.opengl.GL gl)
IGLBindedResource
mount
in interface IGLBindedResource
public void draw(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, Camera cam)
AbstractDrawable
draw
in interface IGLRenderer
draw
in class AbstractDrawable
gl
- GL2 contextglu
- GLU contextcam
- a reference to a shooting Camera.public float getWidth()
public void setWidth(float width)
public Quality getQuality()
public void setQuality(Quality quality)
protected void doDrawElements(com.jogamp.opengl.GL gl)
protected void doBindGL2(com.jogamp.opengl.GL gl)
public Rotator rotator(boolean start)
Rotator
that can let the VBO turn around Z axis centered at X=0,Y=0.
Must be started by Rotator.start()
if not started explicitely.public Rotator rotator()
protected void configure(com.jogamp.opengl.GL gl)
public boolean isHasColorBuffer()
public void setHasColorBuffer(boolean hasColorBuffer)
public int getGeometry()
public void setGeometry(int geometry)
geometry
- public void applyGeometryTransform(Transform transform)
applyGeometryTransform
in class AbstractDrawable
public void updateBounds()
updateBounds
in class AbstractDrawable
public void setData(com.jogamp.opengl.GL gl, FloatVBO vbo)
public void setData(com.jogamp.opengl.GL gl, IntBuffer indices, FloatBuffer vertices, BoundingBox3d bounds)
public void setData(com.jogamp.opengl.GL2 gl, IntBuffer indices, FloatBuffer vertices, BoundingBox3d bounds, int pointer)
public void doConfigure(int pointer, int size)
public void doConfigure(int pointer, int size, int byteOffset, int normalOffset, int dimensions)
public void doLoadArrayFloatBuffer(com.jogamp.opengl.GL gl, FloatBuffer vertices)
public void doLoadArrayFloatBuffer(com.jogamp.opengl.GL gl, int vertexSize, FloatBuffer vertices)
public void doLoadElementIntBuffer(com.jogamp.opengl.GL gl, IntBuffer indices)
public void doLoadElementIntBuffer(com.jogamp.opengl.GL gl, int indexSize, IntBuffer indices)
public void doSetBoundingBox(BoundingBox3d bounds)
public Color getColor()
public void setColor(Color color)
Copyright © 2016. All rights reserved.