project.android.imageprocessing
Class GLRenderer

java.lang.Object
  extended by project.android.imageprocessing.GLRenderer
Direct Known Subclasses:
GLTextureOutputRenderer, JPGFileEndpoint, ScreenEndpoint

public abstract class GLRenderer
extends java.lang.Object

The base renderer class that all inputs, filters and endpoints must extend.

Author:
Chris Batt

Field Summary
static java.lang.String ATTRIBUTE_POSITION
           
static java.lang.String ATTRIBUTE_TEXCOORD
           
static java.lang.String UNIFORM_TEXTURE0
           
static java.lang.String VARYING_TEXCOORD
           
 
Constructor Summary
GLRenderer()
           
 
Method Summary
 void destroy()
          Cleans up the opengl objects for this renderer.
 float getBackgroundAlpha()
          Returns the alpha component of the background colour currently set for this GLRenderer.
 float getBackgroundBlue()
          Returns the blue component of the background colour currently set for this GLRenderer.
 float getBackgroundGreen()
          Returns the green component of the background colour currently set for this GLRenderer.
 float getBackgroundRed()
          Returns the red component of the background colour currently set for this GLRenderer.
 int getHeight()
          Returns the current height the GLRenderer is rendering at.
 int getWidth()
          Returns the current width the GLRenderer is rendering at.
 void onDrawFrame()
          Draws the given texture using OpenGL and the given vertex and fragment shaders.
 void reInitialize()
          Re-initializes the filter on the next drawing pass.
 void rotateClockwise90Degrees(int numOfTimes)
          Rotates the renderer clockwise by 90 degrees a given number of times.
 void rotateCounterClockwise90Degrees(int numOfTimes)
          Rotates the renderer counter-clockwise by 90 degrees a given number of times.
 void setBackgroundAlpha(float alpha)
          Sets only the alpha component of the background colour currently set for this GLRenderer.
 void setBackgroundBlue(float blue)
          Sets only the blue component of the background colour currently set for this GLRenderer.
 void setBackgroundColour(float red, float green, float blue, float alpha)
          Sets the background colour for this GLRenderer to the given colour in rgba space.
 void setBackgroundGreen(float green)
          Sets only the green component of the background colour currently set for this GLRenderer.
 void setBackgroundRed(float red)
          Sets only the red component of the background colour currently set for this GLRenderer.
 void setRenderSize(int width, int height)
          Sets the render size of the renderer to the given width and height.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTRIBUTE_POSITION

public static final java.lang.String ATTRIBUTE_POSITION
See Also:
Constant Field Values

ATTRIBUTE_TEXCOORD

public static final java.lang.String ATTRIBUTE_TEXCOORD
See Also:
Constant Field Values

VARYING_TEXCOORD

public static final java.lang.String VARYING_TEXCOORD
See Also:
Constant Field Values

UNIFORM_TEXTURE0

public static final java.lang.String UNIFORM_TEXTURE0
See Also:
Constant Field Values
Constructor Detail

GLRenderer

public GLRenderer()
Method Detail

getWidth

public int getWidth()
Returns the current width the GLRenderer is rendering at.

Returns:
width

getHeight

public int getHeight()
Returns the current height the GLRenderer is rendering at.

Returns:
height

rotateClockwise90Degrees

public void rotateClockwise90Degrees(int numOfTimes)
Rotates the renderer clockwise by 90 degrees a given number of times.

Parameters:
numOfTimes - The number of times this renderer should be rotated clockwise by 90 degrees.

rotateCounterClockwise90Degrees

public void rotateCounterClockwise90Degrees(int numOfTimes)
Rotates the renderer counter-clockwise by 90 degrees a given number of times.

Parameters:
numOfTimes - The number of times this renderer should be rotated counter-clockwise by 90 degrees.

setRenderSize

public void setRenderSize(int width,
                          int height)
Sets the render size of the renderer to the given width and height. This also prevents the size of the renderer from changing automatically when one of the source(s) of the renderer has a size change. If the renderer has been rotated an odd number of times, the width and height will be swapped.

Parameters:
width - The width at which the renderer should draw at.
height - The height at which the renderer should draw at.

reInitialize

public void reInitialize()
Re-initializes the filter on the next drawing pass.


onDrawFrame

public void onDrawFrame()
Draws the given texture using OpenGL and the given vertex and fragment shaders. Calling of this method is handled by the FastImageProcessingPipeline or other filters and should not be called manually.


destroy

public void destroy()
Cleans up the opengl objects for this renderer. Must be called with opengl context. Normally called by FastImageProcessingPipeline.


setBackgroundColour

public void setBackgroundColour(float red,
                                float green,
                                float blue,
                                float alpha)
Sets the background colour for this GLRenderer to the given colour in rgba space.

Parameters:
red - The red component of the colour.
green - The green component of the colour.
blue - The blue component of the colour.
alpha - The alpha component of the colour.

getBackgroundRed

public float getBackgroundRed()
Returns the red component of the background colour currently set for this GLRenderer.

Returns:
red The red component of the background colour.

setBackgroundRed

public void setBackgroundRed(float red)
Sets only the red component of the background colour currently set for this GLRenderer.

Parameters:
red - The red component to set as the background colour.

getBackgroundGreen

public float getBackgroundGreen()
Returns the green component of the background colour currently set for this GLRenderer.

Returns:
green The green component of the background colour.

setBackgroundGreen

public void setBackgroundGreen(float green)
Sets only the green component of the background colour currently set for this GLRenderer.

Parameters:
green - The green component to set as the background colour.

getBackgroundBlue

public float getBackgroundBlue()
Returns the blue component of the background colour currently set for this GLRenderer.

Returns:
blue The blue component of the background colour.

setBackgroundBlue

public void setBackgroundBlue(float blue)
Sets only the blue component of the background colour currently set for this GLRenderer.

Parameters:
blue - The blue component to set as the background colour.

getBackgroundAlpha

public float getBackgroundAlpha()
Returns the alpha component of the background colour currently set for this GLRenderer.

Returns:
alpha The alpha component of the background colour.

setBackgroundAlpha

public void setBackgroundAlpha(float alpha)
Sets only the alpha component of the background colour currently set for this GLRenderer.

Parameters:
alpha - The alpha component to set as the background colour.