org.scilab.forge.scirenderer.implementation.jogl.sprite
Class RotatableQuadsTextureRenderer

java.lang.Object
  extended by org.scilab.forge.scirenderer.implementation.jogl.sprite.RotatableQuadsTextureRenderer

public class RotatableQuadsTextureRenderer
extends java.lang.Object

Author:
Pierre Lando, Manuel Juliachs Performs the rendering of a rotatable 2D sprite using textured quads. To do: -implement correct screen-space aligning relative to the anchor point, as its apparent position may vary when changing the dimensions of the texture and/or rendered image, or its coordinates (possibly caused by subpixel accuracy and other related rasterization issues). -refactoring (e.g. draw's initialization calls).

Method Summary
protected  void bindTexture(javax.media.opengl.GL gl)
          Bind the texture.
 void dispose(JoGLDrawingTools drawingTools)
          Ask this sprite to dispose.
 void dispose(JoGLDrawingTools drawingTools)
          Ask this sprite to dispose.
 void draw(JoGLDrawingTools drawingTools, SpriteAnchorPosition anchor, ElementsBuffer positions)
          Draw this sprite with the given drawing tools at the given position.
 void draw(JoGLDrawingTools drawingTools, SpriteAnchorPosition anchor, ElementsBuffer positions, double rotationAngle)
          Draw this sprite with the given drawing tools at the given position with the given rotation angle.
 void draw(JoGLDrawingTools drawingTools, SpriteAnchorPosition anchor, Vector3d position)
          Draw this sprite with the given drawing tools at the given position.
 void draw(JoGLDrawingTools drawingTools, SpriteAnchorPosition anchor, Vector3d position)
          Draw this sprite with the given drawing tools at the given position.
 void draw(JoGLDrawingTools drawingTools, SpriteAnchorPosition anchor, Vector3d position, double rotationAngle)
          Draw this sprite with the given drawing tools at the given position with the given rotation angle.
 void draw(JoGLDrawingTools drawingTools, SpriteAnchorPosition anchor, Vector3d position, double rotationAngle)
          Draw this sprite with the given drawing tools at the given position with the given rotation angle.
protected  float getAnchorDeltaX(SpriteAnchorPosition anchor)
          Return the deltaX to apply to the sprite in regards to the given anchor.
protected  float getAnchorDeltaY(SpriteAnchorPosition anchor)
          Return the deltaY to apply to the sprite in regards to the given anchor.
protected  TextureBufferedImage getImage()
          Return the image.
protected  org.scilab.forge.scirenderer.implementation.jogl.sprite.JoGLSprite getSprite()
          Return the sprite.
 void reload()
          Ask the sprite to reset the OpenGl status.
 void reload()
          Ask the sprite to reset the OpenGl status.
protected  void update(javax.media.opengl.GL gl)
          Update the texture.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

draw

public void draw(JoGLDrawingTools drawingTools,
                 SpriteAnchorPosition anchor,
                 ElementsBuffer positions)
Draw this sprite with the given drawing tools at the given position.

Parameters:
drawingTools - the drawing tools to use.
anchor - anchor position.
positions - the position.

draw

public void draw(JoGLDrawingTools drawingTools,
                 SpriteAnchorPosition anchor,
                 ElementsBuffer positions,
                 double rotationAngle)
Draw this sprite with the given drawing tools at the given position with the given rotation angle.

Parameters:
drawingTools - the drawing tools to use.
anchor - anchor position.
positions - the position.
rotationAngle - the rotation angle.

draw

public void draw(JoGLDrawingTools drawingTools,
                 SpriteAnchorPosition anchor,
                 Vector3d position,
                 double rotationAngle)
Draw this sprite with the given drawing tools at the given position with the given rotation angle.

Parameters:
drawingTools - the drawing tools to use.
anchor - anchor position.
position - the position.
rotationAngle - the rotation angle.

draw

public void draw(JoGLDrawingTools drawingTools,
                 SpriteAnchorPosition anchor,
                 Vector3d position)
Draw this sprite with the given drawing tools at the given position.

Parameters:
drawingTools - the drawing tools to use.
anchor - anchor position.
position - the position.

dispose

public void dispose(JoGLDrawingTools drawingTools)
Ask this sprite to dispose.

Parameters:
drawingTools - the drawing tools to use.

reload

public void reload()
Ask the sprite to reset the OpenGl status.


draw

public void draw(JoGLDrawingTools drawingTools,
                 SpriteAnchorPosition anchor,
                 Vector3d position)
Draw this sprite with the given drawing tools at the given position.

Parameters:
drawingTools - the drawing tools to use.
anchor - anchor position.
position - the position.

draw

public void draw(JoGLDrawingTools drawingTools,
                 SpriteAnchorPosition anchor,
                 Vector3d position,
                 double rotationAngle)
Draw this sprite with the given drawing tools at the given position with the given rotation angle.

Parameters:
drawingTools - the drawing tools to use.
anchor - anchor position.
position - the position.
rotationAngle - the rotation angle.

dispose

public void dispose(JoGLDrawingTools drawingTools)
Ask this sprite to dispose.

Parameters:
drawingTools - the drawing tools to use.

reload

public void reload()
Ask the sprite to reset the OpenGl status.


update

protected void update(javax.media.opengl.GL gl)
Update the texture.

Parameters:
gl - the current OpenGl context.

bindTexture

protected void bindTexture(javax.media.opengl.GL gl)
Bind the texture. Create it if it wasn't.

Parameters:
gl - the OpenGl context.

getImage

protected TextureBufferedImage getImage()
Return the image.

Returns:
the image.

getSprite

protected org.scilab.forge.scirenderer.implementation.jogl.sprite.JoGLSprite getSprite()
Return the sprite.

Returns:
the sprite.

getAnchorDeltaX

protected float getAnchorDeltaX(SpriteAnchorPosition anchor)
Return the deltaX to apply to the sprite in regards to the given anchor.

Parameters:
anchor - the given anchor.
Returns:
the deltaX to apply to the sprite in regards to the given anchor.

getAnchorDeltaY

protected float getAnchorDeltaY(SpriteAnchorPosition anchor)
Return the deltaY to apply to the sprite in regards to the given anchor.

Parameters:
anchor - the given anchor.
Returns:
the deltaY to apply to the sprite in regards to the given anchor.