Example usage for javax.microedition.khronos.opengles GL10 GL_TRIANGLES

List of usage examples for javax.microedition.khronos.opengles GL10 GL_TRIANGLES

Introduction

In this page you can find the example usage for javax.microedition.khronos.opengles GL10 GL_TRIANGLES.

Prototype

int GL_TRIANGLES

To view the source code for javax.microedition.khronos.opengles GL10 GL_TRIANGLES.

Click Source Link

Usage

From source file:Main.java

private static final FloatBuffer createDebugColors(int drawMode, int size) {
    ByteBuffer bb = ByteBuffer.allocateDirect(size * 4 * 4);
    bb.order(ByteOrder.nativeOrder());
    FloatBuffer colors = bb.asFloatBuffer();
    if (drawMode == GL10.GL_TRIANGLES) {
        for (int i = 0; i < size * 4; i++) {
            colors.put(triangleColors[i % triangleColors.length]);
        }/* w w w  .  j a  v a  2  s.  com*/
    } else {
        for (int i = 0; i < size; i++) {
            colors.put(1f);
            colors.put(0f);
            colors.put(1f);
            colors.put(1f);
        }
    }
    colors.rewind();
    return colors;
}