Class DrawableVBO
- java.lang.Object
-
- org.jzy3d.plot3d.primitives.Drawable
-
- org.jzy3d.plot3d.primitives.vbo.drawable.DrawableVBO
-
- All Implemented Interfaces:
IGLBindedResource
,IGLRenderer
,ISortableDraw
- Direct Known Subclasses:
BarVBO
,CubeVBO
,PolygonVBO
,ScatterVBO
,ShaderMeshDrawableVBO
,ShaderWaterfallDrawableVBO
,SphereVBO
,TriangleStripVBO
,TriangleVBO
public class DrawableVBO extends Drawable implements IGLBindedResource
ADrawableVBO
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 theDrawableVBO
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);- Author:
- Martin Pernollet
-
-
Field Summary
Fields Modifier and Type Field 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 PolygonMode
polygonMode
protected float
polygonOffsetFactor
protected boolean
polygonOffsetFillEnable
protected float
polygonOffsetUnit
protected Quality
quality
protected int
size
protected float
width
-
Fields inherited from class org.jzy3d.plot3d.primitives.Drawable
bbox, boundingBoxColor, boundingBoxDisplayed, displayed, hasListeners, legend, legendDisplayed, listeners, spaceTransformer, transform, transformBefore
-
-
Constructor Summary
Constructors Constructor Description DrawableVBO(IGLLoader<DrawableVBO> loader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applyGeometryTransform(Transform transform)
protected void
applyPolygonModeFillGL2(com.jogamp.opengl.GL gl)
protected void
applyQuality(com.jogamp.opengl.GL gl)
protected void
applyVertices(com.jogamp.opengl.GL gl)
protected void
applyWidth(com.jogamp.opengl.GL gl)
protected void
color(com.jogamp.opengl.GL gl)
protected void
configure(IPainter painter, com.jogamp.opengl.GL gl)
protected void
disable(com.jogamp.opengl.GL gl)
protected void
disableColor(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, int vertexSize, FloatBuffer vertices)
void
doLoadArrayFloatBuffer(com.jogamp.opengl.GL gl, FloatBuffer vertices)
void
doLoadElementIntBuffer(com.jogamp.opengl.GL gl, int indexSize, IntBuffer indices)
void
doLoadElementIntBuffer(com.jogamp.opengl.GL gl, IntBuffer indices)
void
doSetBoundingBox(BoundingBox3d bounds)
void
draw(IPainter painter)
Call OpenGL2 routines for rendering the object.protected void
enable(com.jogamp.opengl.GL gl)
Color
getColor()
int
getGeometry()
PolygonMode
getPolygonMode()
float
getPolygonOffsetFactor()
float
getPolygonOffsetUnit()
Quality
getQuality()
float
getWidth()
boolean
hasMountedOnce()
Return true if mount(...) has been called at least one timeboolean
isHasColorBuffer()
boolean
isPolygonOffsetFillEnable()
void
mount(IPainter painter)
Mount resources to gl contextprotected void
pointers(com.jogamp.opengl.GL gl)
protected void
polygonOffseFillEnable(com.jogamp.opengl.GL gl)
protected void
polygonOffsetFillDisable(com.jogamp.opengl.GL gl)
Rotator
rotator()
Rotator
rotator(boolean start)
Returns aRotator
that can let the VBO turn around Z axis centered at X=0,Y=0.Rotator
rotator(boolean start, Rotate r, int sleep)
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, IntBuffer indices, FloatBuffer vertices, BoundingBox3d bounds)
void
setData(com.jogamp.opengl.GL gl, FloatVBO vbo)
To be called by the VBOBuildervoid
setGeometry(int geometry)
Set geometry, use: GL.GL_TRIANGLES (default) ...void
setHasColorBuffer(boolean hasColorBuffer)
void
setPolygonMode(PolygonMode polygonMode)
A null polygonMode imply no any call to gl.glPolygonMode(...) at renderingvoid
setPolygonOffsetFactor(float polygonOffsetFactor)
void
setPolygonOffsetFillEnable(boolean polygonOffsetFillEnable)
void
setPolygonOffsetUnit(float polygonOffsetUnit)
void
setQuality(Quality quality)
void
setWidth(float width)
void
updateBounds()
-
Methods inherited from class org.jzy3d.plot3d.primitives.Drawable
addDrawableListener, asWireframeable, dispose, doDrawBoundsIfDisplayed, doTransform, fireDrawableChanged, fireDrawableChanged, getBarycentre, getBoundingBoxColor, getBounds, getDistance, getLegend, getLongestDistance, getShortestDistance, getSpaceTransformer, getTransform, getTransformBefore, hasLegend, isBoundingBoxDisplayed, isDisplayed, isLegendDisplayed, removeDrawableListener, setBoundingBoxColor, setBoundingBoxDisplayed, setDisplayed, setLegend, setLegendDisplayed, setSpaceTransformer, setTransform, setTransformBefore, toString, toString
-
-
-
-
Field Detail
-
geometry
protected int geometry
-
width
protected float width
-
quality
protected Quality quality
-
colorChannelNumber
protected int colorChannelNumber
-
polygonMode
protected PolygonMode polygonMode
-
byteOffset
protected int byteOffset
-
normalOffset
protected int normalOffset
-
dimensions
protected int dimensions
-
size
protected int size
-
pointer
protected int pointer
-
arrayName
protected int[] arrayName
-
elementName
protected int[] elementName
-
hasMountedOnce
protected boolean hasMountedOnce
-
color
protected Color color
-
polygonOffsetFillEnable
protected boolean polygonOffsetFillEnable
-
polygonOffsetFactor
protected float polygonOffsetFactor
-
polygonOffsetUnit
protected float polygonOffsetUnit
-
loader
protected IGLLoader<DrawableVBO> loader
-
-
Constructor Detail
-
DrawableVBO
public DrawableVBO(IGLLoader<DrawableVBO> loader)
-
-
Method Detail
-
hasMountedOnce
public boolean hasMountedOnce()
Description copied from interface:IGLBindedResource
Return true if mount(...) has been called at least one time- Specified by:
hasMountedOnce
in interfaceIGLBindedResource
-
mount
public void mount(IPainter painter)
Description copied from interface:IGLBindedResource
Mount resources to gl context- Specified by:
mount
in interfaceIGLBindedResource
-
draw
public void draw(IPainter painter)
Description copied from class:Drawable
Call OpenGL2 routines for rendering the object.- Specified by:
draw
in interfaceIGLRenderer
- Specified by:
draw
in classDrawable
-
getWidth
public float getWidth()
-
setWidth
public void setWidth(float width)
-
getQuality
public Quality getQuality()
-
setQuality
public void setQuality(Quality quality)
-
doDrawElements
protected void doDrawElements(com.jogamp.opengl.GL gl)
-
disableColor
protected void disableColor(com.jogamp.opengl.GL gl)
-
pointers
protected void pointers(com.jogamp.opengl.GL gl)
-
color
protected void color(com.jogamp.opengl.GL gl)
-
enable
protected void enable(com.jogamp.opengl.GL gl)
-
disable
protected void disable(com.jogamp.opengl.GL gl)
-
applyVertices
protected void applyVertices(com.jogamp.opengl.GL gl)
-
applyWidth
protected void applyWidth(com.jogamp.opengl.GL gl)
-
applyQuality
protected void applyQuality(com.jogamp.opengl.GL gl)
-
applyPolygonModeFillGL2
protected void applyPolygonModeFillGL2(com.jogamp.opengl.GL gl)
-
polygonOffseFillEnable
protected void polygonOffseFillEnable(com.jogamp.opengl.GL gl)
-
polygonOffsetFillDisable
protected void polygonOffsetFillDisable(com.jogamp.opengl.GL gl)
-
doBindGL2
protected void doBindGL2(com.jogamp.opengl.GL gl)
-
rotator
public Rotator rotator(boolean start)
Returns aRotator
that can let the VBO turn around Z axis centered at X=0,Y=0. Must be started by {@link Rotator.start()} if not started explicitely.
-
rotator
public Rotator rotator()
-
configure
protected void configure(IPainter painter, com.jogamp.opengl.GL gl)
-
isHasColorBuffer
public boolean isHasColorBuffer()
-
setHasColorBuffer
public void setHasColorBuffer(boolean hasColorBuffer)
-
getGeometry
public int getGeometry()
-
setGeometry
public void setGeometry(int geometry)
Set geometry, use: GL.GL_TRIANGLES (default) ...- Parameters:
geometry
-
-
applyGeometryTransform
public void applyGeometryTransform(Transform transform)
- Specified by:
applyGeometryTransform
in classDrawable
-
updateBounds
public void updateBounds()
- Specified by:
updateBounds
in classDrawable
-
setData
public void setData(com.jogamp.opengl.GL gl, FloatVBO vbo)
To be called by the VBOBuilder
-
setData
public void setData(com.jogamp.opengl.GL gl, IntBuffer indices, FloatBuffer vertices, BoundingBox3d bounds)
-
setData
public void setData(com.jogamp.opengl.GL2 gl, IntBuffer indices, FloatBuffer vertices, BoundingBox3d bounds, int pointer)
-
doConfigure
public void doConfigure(int pointer, int size)
-
doConfigure
public void doConfigure(int pointer, int size, int byteOffset, int normalOffset, int dimensions)
-
doLoadArrayFloatBuffer
public void doLoadArrayFloatBuffer(com.jogamp.opengl.GL gl, FloatBuffer vertices)
-
doLoadArrayFloatBuffer
public void doLoadArrayFloatBuffer(com.jogamp.opengl.GL gl, int vertexSize, FloatBuffer vertices)
-
doLoadElementIntBuffer
public void doLoadElementIntBuffer(com.jogamp.opengl.GL gl, IntBuffer indices)
-
doLoadElementIntBuffer
public void doLoadElementIntBuffer(com.jogamp.opengl.GL gl, int indexSize, IntBuffer indices)
-
doSetBoundingBox
public void doSetBoundingBox(BoundingBox3d bounds)
-
getPolygonMode
public PolygonMode getPolygonMode()
-
setPolygonMode
public void setPolygonMode(PolygonMode polygonMode)
A null polygonMode imply no any call to gl.glPolygonMode(...) at rendering
-
isPolygonOffsetFillEnable
public boolean isPolygonOffsetFillEnable()
-
setPolygonOffsetFillEnable
public void setPolygonOffsetFillEnable(boolean polygonOffsetFillEnable)
-
getPolygonOffsetFactor
public float getPolygonOffsetFactor()
-
setPolygonOffsetFactor
public void setPolygonOffsetFactor(float polygonOffsetFactor)
-
getPolygonOffsetUnit
public float getPolygonOffsetUnit()
-
setPolygonOffsetUnit
public void setPolygonOffsetUnit(float polygonOffsetUnit)
-
getColor
public Color getColor()
-
setColor
public void setColor(Color color)
-
-