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

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

Introduction

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

Prototype

int GL_CULL_FACE

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

Click Source Link

Usage

From source file:org.interreg.docexplore.reader.shelf.ShelfEngine.java

License:Open Source License

public synchronized void render() {
    if (alpha < .01)
        return;/*from  w ww  .  j  a  v a  2 s . co m*/

    GL10 gl = Gdx.gl10;

    gl.glDisable(GL10.GL_LIGHTING);
    gl.glDisable(GL10.GL_DEPTH_TEST);
    gl.glDisable(GL10.GL_CULL_FACE);
    gl.glDisable(GL10.GL_STENCIL_TEST);

    gl.glMatrixMode(GL10.GL_MODELVIEW);
    gl.glPushMatrix();
    gl.glLoadIdentity();
    gl.glMatrixMode(GL10.GL_PROJECTION);
    gl.glPushMatrix();
    gl.glLoadIdentity();
    gl.glOrthof(0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), 0, -1, 1);

    gl.glEnable(GL10.GL_TEXTURE_2D);

    if (textures == null)
        cursor = -1;
    else if (cursor > textures.length)
        cursor = textures.length - 1;
    if (cursor >= 0) {
        for (int i = 0; i < textures.length; i++) {
            int j = (textures.length / 2 + (i + 1) / 2 * (i % 2 == 0 ? 1 : -1)) % textures.length;
            int index = (cursor + j) % textures.length;
            Texture tex = textures[index];
            if (tex != null) {
                double x = getEntryX(j);
                double y = getEntryY(j);
                float k = (float) (.75 + .125 * (y + 1));
                k *= k;
                //float colk = (float)(.5*(y+1));
                gl.glColor4f(1, 1, 1, alpha * k);
                float x0 = (float) (.5 * (Gdx.graphics.getWidth() - k * tex.width())
                        + x * Gdx.graphics.getWidth() / 4);
                float y0 = (float) (.5 * (Gdx.graphics.getHeight() - k * tex.height())
                        + y * Gdx.graphics.getHeight() / 5);
                tex.bind();
                GfxUtils.fillQuad(x0, y0, 0, 0, x0 + k * tex.width(), y0 + k * tex.height(), 1, 1);
            }
        }
    }

    gl.glMatrixMode(GL10.GL_PROJECTION);
    gl.glPopMatrix();
    gl.glMatrixMode(GL10.GL_MODELVIEW);
    gl.glPopMatrix();

    gl.glEnable(GL10.GL_DEPTH_TEST);
    gl.glDisable(GL10.GL_TEXTURE_2D);
}

From source file:se.claremont.android.wallpaper.ClaremontWallpaper.java

License:Apache License

@Override
public void render() {

    ///*from w ww. j  a v a  2 s. c  o m*/
    // Set GL state
    //
    GL10 gl = Gdx.graphics.getGL10();
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
    gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    gl.glDisable(GL10.GL_DITHER);
    gl.glEnable(GL10.GL_DEPTH_TEST);
    gl.glEnable(GL10.GL_CULL_FACE);
    gl.glEnable(GL10.GL_COLOR_MATERIAL);
    gl.glHint(GL10.GL_POLYGON_SMOOTH_HINT, GL10.GL_NICEST);
    gl.glEnable(GL10.GL_LIGHTING);
    gl.glEnable(GL10.GL_LIGHT0);

    //
    // Update light position
    //
    lightPosition.put(0, perspectiveCamera.position.x);
    lightPosition.put(1, perspectiveCamera.position.y);
    lightPosition.put(2, perspectiveCamera.position.z);
    gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_POSITION, lightPosition);

    //
    // Update camera position/direction
    //
    perspectiveCamera.position.set(perspectiveCameraCurrentPosition);
    perspectiveCamera.direction.set(perspectiveCameraCurrentDirection);
    perspectiveCamera.position.rotate(Gdx.graphics.getDeltaTime(), 0f, 1f, 0f);
    perspectiveCamera.direction.rotate(Gdx.graphics.getDeltaTime(), 0f, 1f, 0f);
    perspectiveCameraCurrentPosition = perspectiveCamera.position;
    perspectiveCameraCurrentDirection = perspectiveCamera.direction;
    perspectiveCamera.update();
    perspectiveCamera.apply(gl);

    //
    // Render Claremont text model
    //
    gl.glPushMatrix();
    gl.glColor4f(1f, 1f, 1f, 1f);
    gl.glRotatef(0.25f, 1f, 0f, 0f);
    claremontText.render(GL10.GL_TRIANGLES);
    gl.glPopMatrix();

    //
    // Render Claremont orb model
    //
    gl.glPushMatrix();
    gl.glColor4f(0.36862745f, 0.63921569f, 0.82352941f, 1f);
    gl.glRotatef(0.25f, 1f, 0f, 0f);
    claremontOrb.render(GL10.GL_TRIANGLES);
    gl.glPopMatrix();

}