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

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

Introduction

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

Prototype

public void glTranslatef(float x, float y, float z);

Source Link

Usage

From source file:com.digitale.mygdxgame.SplashRenderer.java

License:Open Source License

/**
* render ship jets//w  w  w.j av  a  2 s  . com
* @param basescale :- scale factor for jet size before applying thrust
* @param length  :- scale factor for jet length, typically thrust value + random noise
* @param x The jet's x-coordinate.
* @param y The jet's  y-coordinate.
* @param z The jet's  z-coordinate.
* @return The product, in a vector <#, #, #, 1>, representing the
* rotated point.
*/
private void renderJet(GL10 gl, float baseScale, float length, float x, float y, float z, Application app) {
    jetTexture.bind();
    gl.glPushMatrix();
    //move away from origin
    gl.glTranslatef(x, y, z);
    //scale to size of earth
    gl.glScalef(baseScale, baseScale, baseScale * length);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE);
    gl.glDisable(GL10.GL_LIGHTING);
    //gl.glRotatef((Splash.planetmove/10), .25f, .75f, .5f);
    jetMesh.render(GL10.GL_TRIANGLES);
    gl.glPopMatrix();
    gl.glEnable(GL10.GL_LIGHTING);
    //gl.glEnable(GL10.GL_DEPTH_TEST);
}

From source file:org.interreg.docexplore.reader.book.BookEngineRenderer.java

License:Open Source License

public void render() {
    BookSpecification spec = engine.book;
    BookModel model = engine.model;//w  w  w.  ja v a  2  s .  c  om

    GL10 gl = Gdx.gl10;

    cnt += .01;

    engine.attractor.attract(engine.camera, .075f);

    gl.glMatrixMode(GL10.GL_MODELVIEW);
    gl.glPushMatrix();
    gl.glMatrixMode(GL10.GL_PROJECTION);
    gl.glPushMatrix();
    engine.camera.apply(gl);

    gl.glEnable(GL10.GL_LIGHTING);
    gl.glEnable(GL10.GL_LIGHT0);
    gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_AMBIENT, ambient);
    gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_DIFFUSE, diffuse);
    gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_POSITION, position);

    gl.glMatrixMode(GL10.GL_MODELVIEW);
    gl.glTranslatef((float) engine.globalTrans, 0, 0);
    gl.glRotatef((float) (engine.globalRot * 180 / Math.PI), 0, 1, 0);

    boolean pageIsActive = engine.hand.pageIsActive;
    int leftPageIndex = model.leftStack.nStackPages > 0 ? 1 + 2 * (model.leftStack.nStackPages - 1) : -1;
    int rightPageIndex = model.rightStack.nStackPages > 0 ? leftPageIndex + 1 + (pageIsActive ? 2 : 0) : -1;

    Bindable leftPage = leftPageIndex >= 0 ? spec.pages.get(leftPageIndex).getTexture() : null;
    Bindable rightPage = rightPageIndex >= 0 ? spec.pages.get(rightPageIndex).getTexture() : null;
    Bindable pageFront = pageIsActive ? spec.pages.get(leftPageIndex + 1).getTexture() : null;
    Bindable pageBack = pageIsActive ? spec.pages.get(leftPageIndex + 2).getTexture() : null;

    Gdx.gl10.glEnable(GL10.GL_CULL_FACE);
    gl.glPolygonMode(GL10.GL_FRONT_AND_BACK, GL10.GL_FILL);

    boolean zoomed = engine.zoom.active;
    model.render(leftPage, rightPage, pageFront, pageBack, engine.book.coverTex, engine.book.innerCoverTex,
            zoomed ? null : leftRoiMask, zoomed ? null : rightRoiMask);

    for (Component extension : engine.components)
        extension.render();

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

From source file:org.interreg.docexplore.reader.book.roi.ROIOverlay.java

License:Open Source License

static void doQuad(float x1, float y1, float x2, float y2) {
    if (quad == null)
        quad = GfxUtils.buildQuad(0, 0, 0, 0, 1, 1, 1, 1);

    GL10 gl = Gdx.gl10;
    gl.glMatrixMode(GL10.GL_MODELVIEW);//from   w  w  w  .j a v a  2 s.co  m
    gl.glPushMatrix();
    gl.glTranslatef(x1, y1, 0);
    gl.glScalef(x2 - x1, y2 - y1, 1);
    quad.render(GL10.GL_TRIANGLES);
    gl.glPopMatrix();
}