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

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

Introduction

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

Prototype

int GL_CW

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

Click Source Link

Usage

From source file:com.example.artest.SimpleRenderer.java

/**
 * Override the draw function from ARRenderer.
 *///from  w  ww  .j  a  va2  s  . c  om
@Override
public void draw(GL10 gl) {

    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

    // Apply the ARToolKit projection matrix
    gl.glMatrixMode(GL10.GL_PROJECTION);
    gl.glLoadMatrixf(ARToolKit.getInstance().getProjectionMatrix(), 0);

    gl.glEnable(GL10.GL_CULL_FACE);
    gl.glShadeModel(GL10.GL_SMOOTH);
    gl.glEnable(GL10.GL_DEPTH_TEST);
    gl.glFrontFace(GL10.GL_CW);

    // If the marker is visible, apply its transformation, and draw a cube
    for (int i = 0; i < markerIDs.length; i++) {
        if (ARToolKit.getInstance().queryMarkerVisible(markerIDs[i])) {
            gl.glMatrixMode(GL10.GL_MODELVIEW);
            gl.glLoadMatrixf(ARToolKit.getInstance().queryMarkerTransformation(markerIDs[i]), 0);
            cube[i].draw(gl);
            markerVisible[i] = true;
        } else {
            markerVisible[i] = false;
        }
    }
}