Graphics Programs Reference
In-Depth Information
ByteBuffer lineIBB =
ByteBuffer.allocateDirect(lineISA.length * 2);
_lineISB = lineIBB.asShortBuffer();
Finally, to render this wireframe rectangle, replace the call to glDrawArrays with
glDrawElements using suitable arguments.
As shown in Listing 4-6 , the mode argument is GL_LINES , the count argument
is '8', the type argument is GL_UNSIGNED_SHORT , and the last argument is the
ShortBuffer .
Listing 4-6. GL LINE ELEMENTS/src/com/apress/android/gllineelements/
GLES20.glDrawElements(GLES20.GL_LINES, 8,
Rendering triangle primitives is left as an exercise for you; however, if you have
any confusion about this, go through the Renderer class inside the GL TRIANGLE
ELEMENTS application ( Chapter4/ ). If you run
this application, you see output similar to Figure 4-2 .
Search WWH ::

Custom Search