org.jzy3d.plot3d.primitives.axes
Class FeedbackBufferAxeBox

java.lang.Object
  extended by org.jzy3d.plot3d.primitives.axes.AxeBox
      extended by org.jzy3d.plot3d.primitives.axes.FeedbackBufferAxeBox
All Implemented Interfaces:
IAxe

public class FeedbackBufferAxeBox
extends AxeBox
implements IAxe

This AxeBox implementation was the first to appear in Jzy3d. It computes hidden faces using the OpenGL feedback buffer, which seems to fail on some hardware (especially Lenovo notepads). The parent AxeBox doesn't rely anymore one feedback buffer, and this implementation has been kept in order to provide an example of feedback buffer use.

Author:
Martin Pernollet
See Also:
http://code.google.com/p/jzy3d/issues/detail?id=10

Field Summary
 
Fields inherited from class org.jzy3d.plot3d.primitives.axes.AxeBox
AXE_X, AXE_Y, AXE_Z, axeXquads, axeXx, axeXy, axeXz, axeYquads, axeYx, axeYy, axeYz, axeZquads, axeZx, axeZy, axeZz, boxBounds, center, layout, normx, normy, normz, PRECISION, quadIsHidden, quadx, quady, quadz, scale, txt, txtRenderer, view, wholeBounds, xrange, yrange, zrange
 
Constructor Summary
FeedbackBufferAxeBox(BoundingBox3d bbox)
           
FeedbackBufferAxeBox(BoundingBox3d bbox, IAxeLayout layout)
           
 
Method Summary
 void draw(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu, Camera camera)
          Draws the AxeBox.
protected  void drawCube(javax.media.opengl.GL2 gl, int mode)
          Make all GL calls allowing to build a cube with 6 separate quads.
protected  boolean[] getEmptyTokens(int ntokens, float[] buffer, int size)
          This utility function inform wether a GL_PASS_THROUGH_TOKEN was followed by other OpenGL tokens (GL_POLYGON_TOKEN, GL_LINE_TOKEN, etc), or not.
protected  boolean[] getHiddenQuads(javax.media.opengl.GL2 gl)
          COMPUTATION OF HIDDEN QUADS
protected  int print3DcolorVertex(int size, int count, float[] buffer)
          Print out parameters of a gl call in 3dColor mode.
protected  void printHiddenQuads()
          Print out display status of quads.
 
Methods inherited from class org.jzy3d.plot3d.primitives.axes.AxeBox
dispose, drawGridOnQuad, drawTicks, drawTicks, findClosestXaxe, findClosestYaxe, findClosestZaxe, getBoxBounds, getCenter, getExperimentalTextRenderer, getHiddenQuads, getLayout, getTextRenderer, getView, getWholeBounds, init, min, setAxe, setAxeBox, setExperimentalTextOverlayRenderer, setScale, setTextRenderer, setView
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jzy3d.plot3d.primitives.axes.IAxe
dispose, getBoxBounds, getCenter, getLayout, setAxe, setScale
 

Constructor Detail

FeedbackBufferAxeBox

public FeedbackBufferAxeBox(BoundingBox3d bbox)

FeedbackBufferAxeBox

public FeedbackBufferAxeBox(BoundingBox3d bbox,
                            IAxeLayout layout)
Method Detail

draw

public void draw(javax.media.opengl.GL2 gl,
                 javax.media.opengl.glu.GLU glu,
                 Camera camera)
Description copied from class: AxeBox
Draws the AxeBox. The camera is used to determine which axis is closest to the ur point ov view, in order to decide for an axis on which to diplay the tick values.

Specified by:
draw in interface IAxe
Overrides:
draw in class AxeBox

drawCube

protected void drawCube(javax.media.opengl.GL2 gl,
                        int mode)
Make all GL calls allowing to build a cube with 6 separate quads. Each quad is indexed from 0.0f to 5.0f using glPassThrough, and may be traced in feedback mode when mode=GL.GL_FEEDBACK

Overrides:
drawCube in class AxeBox

getHiddenQuads

protected boolean[] getHiddenQuads(javax.media.opengl.GL2 gl)
COMPUTATION OF HIDDEN QUADS


getEmptyTokens

protected boolean[] getEmptyTokens(int ntokens,
                                   float[] buffer,
                                   int size)
This utility function inform wether a GL_PASS_THROUGH_TOKEN was followed by other OpenGL tokens (GL_POLYGON_TOKEN, GL_LINE_TOKEN, etc), or not. In the first case, the given token is considered as non empty, in the other case, it is considered as empty. The expected use of this function is to inform the user wether a polygon has been displayed or not in the case Culling was activated. Note: this function is only intended to work in the case where gl.glFeedbackBuffer is called with GL.GL_3D_COLOR as second argument, i.e. vertices are made of x, y, z, alpha values and a color. Thus, no texture may be used, and trying to parse a GL_BITMAP_TOKEN, GL_DRAW_PIXEL_TOKEN, or GL_COPY_PIXEL_TOKEN will throw a RuntimeException. Note: this function only works with PASS_THROUGH_TOKEN with a positive integer value, since this value will be used as an index in the boolean array returned by the function TODO: use a map to associate a float token to a polygon with an id?

Throws:
a - RuntimeException if a parsed token is either GL_BITMAP_TOKEN, GL_DRAW_PIXEL_TOKEN, or GL_COPY_PIXEL_TOKEN.

print3DcolorVertex

protected int print3DcolorVertex(int size,
                                 int count,
                                 float[] buffer)
Print out parameters of a gl call in 3dColor mode.

Overrides:
print3DcolorVertex in class AxeBox

printHiddenQuads

protected void printHiddenQuads()
Print out display status of quads.

Overrides:
printHiddenQuads in class AxeBox