Example usage for com.badlogic.gdx.graphics GL20 GL_TEXTURE_BINDING_2D

List of usage examples for com.badlogic.gdx.graphics GL20 GL_TEXTURE_BINDING_2D

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics GL20 GL_TEXTURE_BINDING_2D.

Prototype

int GL_TEXTURE_BINDING_2D

To view the source code for com.badlogic.gdx.graphics GL20 GL_TEXTURE_BINDING_2D.

Click Source Link

Usage

From source file:ta.shape3D.mesh.MeshTA.java

License:Apache License

/**
 * draw all triangles of the Mesh in the OpenGL environment.
 * @param rendu the renderer which is used for drawing triangle, you don't need to call the begin() method of this renderer
 * before using this method./*from   ww  w .  jav  a  2 s. c o m*/
 * @param rendu 
 * @param projectionMatrix The projection matrix in which the mesh will be represented 
 */
final public void render(ImmediateModeRenderer20 rendu, Matrix4 projectionMatrix) {
    projectionMatrix.translate(tX, tY, tZ);
    projectionMatrix.rotateRad(Vector3.X, rX);
    projectionMatrix.rotateRad(Vector3.Y, rY);
    projectionMatrix.rotateRad(Vector3.Z, rZ);
    projectionMatrix.scale(scaleX, scaleY, scaleZ);
    if (image != null) {
        Gdx.gl20.glEnable(GL20.GL_TEXTURE_2D);
        Gdx.gl20.glBindTexture(image.glTarget, image.getTextureObjectHandle());
    }
    rendu.begin(projectionMatrix, GL20.GL_TRIANGLES);
    for (Triangle3D t : triangles) {
        t.render(rendu);
    }
    rendu.end();
    Gdx.gl20.glDisable(GL20.GL_TEXTURE_BINDING_2D);
    for (MeshTA m : sousMesh) {
        m.render(rendu, projectionMatrix);
    }
    projectionMatrix.scale(1 / scaleX, 1 / scaleY, 1 / scaleZ);
    projectionMatrix.rotateRad(Vector3.X, -rX);
    projectionMatrix.rotateRad(Vector3.Y, -rY);
    projectionMatrix.rotateRad(Vector3.Z, -rZ);
    projectionMatrix.translate(-tX, -tY, -tZ);
}