edu.eside.flingbox.graphics
Class RenderPolygon

java.lang.Object
  extended by edu.eside.flingbox.graphics.RenderBody
      extended by edu.eside.flingbox.graphics.RenderPolygon

public class RenderPolygon
extends RenderBody

RenderPolygon handles functions to render Polygon into OpenGL's space. Translation and rotation values should be set in AtomicBody and calculated by physic engine. This should only be instantiate by Polygon.


Constructor Summary
RenderPolygon(Vector2D[] points)
          Default constructor of PolygonRender.
 
Method Summary
 boolean onRender(GL10 gl)
          Renderizes Polygon into gl
 void setColor(float r, float g, float b, float alpha)
          Sets color of the polygon
 void setPosition(Vector2D position, float rotation)
          Sets object's position to render
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RenderPolygon

public RenderPolygon(Vector2D[] points)
Default constructor of PolygonRender. initializes values needed by OpenGL.

Parameters:
points - Polygon's points, with centroid at 0,0
Method Detail

setColor

public void setColor(float r,
                     float g,
                     float b,
                     float alpha)
Sets color of the polygon

Parameters:
r - Red channel [0, 1]
g - Green channel [0, 1]
b - Blue channel [0, 1]
alpha - Alpha channel, sets object's transparency, 0 for transparent 1 for opaque.

setPosition

public void setPosition(Vector2D position,
                        float rotation)
Sets object's position to render

Parameters:
position - Point to current position
rotation - Rotation angle in radiants

onRender

public boolean onRender(GL10 gl)
Renderizes Polygon into gl

Specified by:
onRender in class RenderBody
Parameters:
gl - OpenGL's space
Returns:
true if render consumed