Example usage for com.badlogic.gdx.graphics GL10 GL_TRIANGLE_STRIP

List of usage examples for com.badlogic.gdx.graphics GL10 GL_TRIANGLE_STRIP

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics GL10 GL_TRIANGLE_STRIP.

Prototype

int GL_TRIANGLE_STRIP

To view the source code for com.badlogic.gdx.graphics GL10 GL_TRIANGLE_STRIP.

Click Source Link

Usage

From source file:com.badlogic.gdx.physics.bullet.demo.simulationobjects.StaticPlaneSimulationObject.java

@Override
public void render(SimulationScreen screen) {
    /*/*  w  w  w .j  ava 2 s.  c  om*/
     * Our StaticPlaneShape holds the plane vector and scalar. Use it instead of the applied render transform from
     * the kinematic (not updated/calculated for static planes).
     */

    Gdx.gl10.glPushMatrix();

    // Get the plane normal
    final Vector3 planeNormal = Pools.VECTOR3.obtain();
    planeNormal.set(staticPlaneShape.getPlaneNormal());

    final float planeConstant = staticPlaneShape.getPlaneConstant();

    // Calculate the plane origin
    final Vector3 planeOrigin = Pools.VECTOR3.obtain();
    planeOrigin.set(planeNormal);
    planeOrigin.scale(planeConstant, planeConstant, planeConstant);

    // Move to the origin
    Gdx.gl10.glTranslatef(planeOrigin.x, planeOrigin.y, planeOrigin.z);

    // Compute the angle difference between the plane and mesh normal ("up")
    float angle = MathUtils.radiansToDegrees * BulletDemoMath.angle(planeNormal, MESH_NORMAL);

    // Cross product gives us the vector around which to rotate
    planeNormal.crs(MESH_NORMAL);

    // Rotate by that angle
    Gdx.gl10.glRotatef(angle, planeNormal.x, planeNormal.y, planeNormal.z);

    Gdx.gl10.glColor4f(1, 1, 1, 1);
    Gdx.gl10.glEnable(GL10.GL_TEXTURE_2D);
    Gdx.gl10.glEnable(GL10.GL_COLOR_MATERIAL);

    screen.enableLights();
    texture.bind();
    mesh.render(GL10.GL_TRIANGLE_STRIP);

    Gdx.gl10.glPopMatrix();

    Pools.VECTOR3.free(planeNormal);
    Pools.VECTOR3.free(planeOrigin);
}