|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.neovisionaries.android.opengl.Drawer<ElementDrawer>
com.neovisionaries.android.opengl.ElementDrawer
public class ElementDrawer
Drawer to draw primitives using glDrawElements().
On Android 2.2 (API Level 8), the constructors that take ElementArrayBuffer
and setIndices(ElementArrayBuffer)
method should not be used. This is because
android.opengl.GLES20 class of Android 2.2 does not have
glDrawElements(int mode, int count, int type, int offset) method
(note that the last argument is 'int offset') although it should
have. Without the glDrawElements method, the element array buffer
(represented by ElementArrayBuffer
) cannot be used.
Constructor Summary | |
---|---|
ElementDrawer()
A constructor that just calls super() . |
|
ElementDrawer(DrawingMode mode)
A constructor that just calls super (mode). |
|
ElementDrawer(DrawingMode mode,
Buffer indices)
This constructor is an alias of ElementDrawer (mode, indices, 0). |
|
ElementDrawer(DrawingMode mode,
Buffer indices,
int count)
A constructor with indices data. |
|
ElementDrawer(DrawingMode mode,
ElementArrayBuffer indices)
This constructor is an alias of ElementArrayBuffer (mode, indices,
0, 0). |
|
ElementDrawer(DrawingMode mode,
ElementArrayBuffer indices,
int count)
This constructor is an alias of ElementArrayBuffer (mode, indices,
count, 0). |
|
ElementDrawer(DrawingMode mode,
ElementArrayBuffer indices,
int count,
int offset)
A constructor with indices data held in the element array buffer. |
Method Summary | |
---|---|
ElementDrawer |
draw()
Draw primitives. |
int |
getCount()
Get the number of indices used for drawing. |
Object |
getIndices()
Get the indices that this drawer currently holds. |
int |
getOffset()
Get the offset from the start of the element array buffer. |
ElementDrawer |
setCount(int count)
Set the number of indices used for drawing. |
ElementDrawer |
setIndices(Buffer indices)
Set the indices used for drawing. |
ElementDrawer |
setIndices(ElementArrayBuffer indices)
Set the indices used for drawing. |
ElementDrawer |
setOffset(int offset)
Set the offset from the start of the element array buffer. |
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 |
---|
public ElementDrawer()
super()
.
public ElementDrawer(DrawingMode mode)
super
(mode).
mode
- A drawing mode.
IllegalArgumentException
- The argument is null.public ElementDrawer(DrawingMode mode, Buffer indices)
ElementDrawer
(mode, indices, 0).
public ElementDrawer(DrawingMode mode, Buffer indices, int count)
mode
- A drawing mode.indices
- Indices data. The actual class of 'indices' must be
either ByteBuffer or ShortBuffer. If the extension
OES_element_index_uint
is supported, IntBuffer is
also acceptable.count
- The number of indices.
IllegalArgumentException
- OES_element_index_uint
is supported, the actual class
of 'indices' is allowed to be IntBuffer.
public ElementDrawer(DrawingMode mode, ElementArrayBuffer indices)
ElementArrayBuffer
(mode, indices,
0, 0).
public ElementDrawer(DrawingMode mode, ElementArrayBuffer indices, int count)
ElementArrayBuffer
(mode, indices,
count, 0).
public ElementDrawer(DrawingMode mode, ElementArrayBuffer indices, int count, int offset)
It is necessary for 'indices' to have data before it is passed
to this constructor. In other words, setData()
method must have been called. Otherwise, this
constructor throws IllegalArgumentException.
Note that this constructor should not be used in Android 2.2 (API Level 8).
indices
- count
- The number of indices.offset
- The offset from the start of the element array buffer.
IllegalArgumentException
- VertexBuffer.setData(Buffer,
int, VertexBufferUsage)
is not ByteBuffer or ShortBuffer.
(IntBuffer is allowed if the extension OES_element_index_uint
is supported.)
Method Detail |
---|
public Object getIndices()
Buffer
or ElementArrayBuffer
.
If neither setIndices(Buffer)
nor setIndices(ElementArrayBuffer)
has been called,
null is returned.public ElementDrawer setIndices(Buffer indices)
indices
-
IllegalArgumentException
- OES_element_index_uint
is supported.)
public ElementDrawer setIndices(ElementArrayBuffer indices)
It is necessary for the given object to have data before
it is passed to this method. In other words, setData()
method must have been called. Otherwise, this
setIndices() method throws IllegalArgumentException.
Note that this method should not be used in Android 2.2 (API Level 8).
indices
-
IllegalArgumentException
- VertexBuffer.setData(Buffer,
int, VertexBufferUsage)
is not ByteBuffer or ShortBuffer.
(IntBuffer is allowed if the extension OES_element_index_uint
is supported.)
public int getCount()
public ElementDrawer setCount(int count)
count
- The number of indices used for drawing.
IllegalArgumentException
- The argument is less than 0.public int getOffset()
public ElementDrawer setOffset(int offset)
The value set by this method has a meaning only when indices
are fed by the element array buffer. In other words, it has
a meaning only if setIndices(ElementArrayBuffer)
is used.
offset
- The offset from the start of the element array buffer.
public ElementDrawer draw()
If the index data this instance holds is an instance of Buffer and if the element array buffer holds some data, this method unbinds the element array buffer so that the index data can take effect.
On the contrary, the index data this instance holds is an
instance of ElementArrayBuffer
and if the ID of the
data that is currently bound to the element array buffer is
different from the ID of the index data (simply saying, if
the index data's isBound()
method returns false), this method binds the index data to
the element array buffer (= this method calls the index
data's bind()
method) so
that the index data can take effect.
draw
in class Drawer<ElementDrawer>
IllegalStateException
- Indices are not set. That is, neither setIndices(Buffer)
nor setIndices(ElementArrayBuffer)
has been called.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |