com.neovisionaries.android.opengl
Class ArrayDrawer

java.lang.Object
  extended by com.neovisionaries.android.opengl.Drawer<ArrayDrawer>
      extended by com.neovisionaries.android.opengl.ArrayDrawer

public class ArrayDrawer
extends Drawer<ArrayDrawer>

Drawer to draw primitives using glDrawArrays().

 // E X A M P L E S

 // All of the lines below are equivalent to
 // glDrawArrays(GL_TRIANGLES, 0, 3).

 new ArrayDrawer().setMode(DrawingMode.TRIANGLES).setFirst(0).setCount(3).draw();
 
 new ArrayDrawer(DrawingMode.TRIANGLES).setFirst(0).setCount(3).draw();

 new ArrayDrawer(DrawingMode.TRIANGLES, 3).setFirst(0).draw();

 new ArrayDrawer(DrawingMode.TRIANGLES, 0, 3).draw();
 

Author:
Takahiko Kawasaki
See Also:
glDrawArrays

Constructor Summary
ArrayDrawer()
          This constructor is an alias of ArrayDrawer(DrawingMode.TRIANGLES, 0, 0).
ArrayDrawer(DrawingMode mode)
          This constructor is an alias of ArrayDrawer(mode, 0, 0).
ArrayDrawer(DrawingMode mode, int count)
          This constructor is an alias of ArrayDrawer(mode, 0, count).
ArrayDrawer(DrawingMode mode, int first, int count)
          A constructor.
 
Method Summary
 ArrayDrawer draw()
          Draw primitives.
 int getCount()
          Get the number of vertices used for drawing.
 int getFirst()
          Get the index of the first vertex used for drawing.
 ArrayDrawer setCount(int count)
          Set the number of vertices used for drawing.
 ArrayDrawer setFirst(int first)
          Set the index of the first vertex used for drawing.
 
Methods inherited from class com.neovisionaries.android.opengl.Drawer
getMode, setMode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayDrawer

public ArrayDrawer()
This constructor is an alias of ArrayDrawer(DrawingMode.TRIANGLES, 0, 0).

See Also:
ArrayDrawer(DrawingMode, int, int)

ArrayDrawer

public ArrayDrawer(DrawingMode mode)
This constructor is an alias of ArrayDrawer(mode, 0, 0).

See Also:
ArrayDrawer(DrawingMode, int, int)

ArrayDrawer

public ArrayDrawer(DrawingMode mode,
                   int count)
This constructor is an alias of ArrayDrawer(mode, 0, count).

See Also:
ArrayDrawer(DrawingMode, int, int)

ArrayDrawer

public ArrayDrawer(DrawingMode mode,
                   int first,
                   int count)
A constructor.

Parameters:
mode - A drawing mode.
first - The index of the first vertex used for drawing in the vertex array.
count - The number of vertices used for drawing.
Throws:
IllegalArgumentException - 'mode' is null, 'first' is less than 0, or 'count' is less than 0.
Method Detail

getFirst

public int getFirst()
Get the index of the first vertex used for drawing.

Returns:
The index of the first vertex used for drawing in the vertex array.

setFirst

public ArrayDrawer setFirst(int first)
Set the index of the first vertex used for drawing.

Parameters:
first - The index of the first vertex used for drawing.
Returns:
This ArrayDrawer object.
Throws:
IllegalArgumentException - 'first' is less than 0.

getCount

public int getCount()
Get the number of vertices used for drawing.

Returns:
The number of vertices used for drawing.

setCount

public ArrayDrawer setCount(int count)
Set the number of vertices used for drawing.

Parameters:
count - The number of vertices used for drawing.
Returns:
This ArrayDrawer object.

draw

public ArrayDrawer draw()
Draw primitives.

This method is equlvalent to glDrawArrays(Drawer.getMode().getMode(), getFirst(), getCount()).

Specified by:
draw in class Drawer<ArrayDrawer>
Returns:
This ArrayDrawer object.
See Also:
glDrawArrays