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

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

Introduction

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

Prototype

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

Source Link

Usage

From source file:com.davidykay.shootout.Renderer.java

License:Apache License

private void renderMoon(GL10 gl, Ship ship) {
    moonTexture.bind();/*from  w w w  .  ja v a 2 s. c  o  m*/
    gl.glPushMatrix();
    final float MOON_RADIUS = 10.0f;
    final float MOON_SCALE = MOON_RADIUS;

    //gl.glTranslatef(ship.position.x, ship.position.y - MOON_RADIUS, ship.position.z);
    gl.glTranslatef(0.0f, ship.position.y - MOON_RADIUS, 0.0f);
    gl.glScalef(MOON_SCALE, MOON_SCALE, MOON_SCALE);
    //gl.glRotatef(45 * (-app.getInput().getAccelerometerY() / 5), 0, 0, 1);
    //gl.glRotatef(180, 0, 1, 0);

    moonMesh.render(GL10.GL_TRIANGLES);
    gl.glPopMatrix();
}

From source file:com.davidykay.shootout.Renderer.java

License:Apache License

private void renderPlayerRays(GL10 gl, ArrayList<RayShot> rays) {
    //0, 215, 237
    gl.glColor4f(0, 215 / 255.0f, 237 / 255.0f, 1);
    for (RayShot ray : rays) {
        gl.glPushMatrix();/*from www  .java2s. c  o m*/
        gl.glTranslatef(ray.position.x, ray.position.y, ray.position.z);
        gl.glScalef(ray.radius, ray.radius, ray.radius);
        rayMesh.render(GL10.GL_TRIANGLES);
        gl.glPopMatrix();
    }
    // Reset color to white?.
    gl.glColor4f(1, 1, 1, 1);
}

From source file:com.davidykay.shootout.Renderer.java

License:Apache License

private void renderAlienRays(GL10 gl, ArrayList<RayShot> rays) {
    gl.glColor4f(1, 1, 0, 1);/* ww  w  .j a  v a 2s . c om*/
    for (RayShot ray : rays) {
        gl.glPushMatrix();
        gl.glTranslatef(ray.position.x, ray.position.y, ray.position.z);
        gl.glScalef(ray.radius, ray.radius, ray.radius);
        rayMesh.render(GL10.GL_TRIANGLES);
        gl.glPopMatrix();
    }
    // Reset color to white?.
    gl.glColor4f(1, 1, 1, 1);
}

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

License:Open Source License

/**
 * @param gl//from  w ww  . j a  v  a 2s .  c  o  m
 * @param shipname
 * @param velocity
 */
private void renderJets(GL10 gl, String shipname, float velocity) {
    float noise = (float) Math.random();
    float length = velocity / 50;
    gl.glEnable(GL10.GL_BLEND);
    gl.glDisable(GL10.GL_CULL_FACE);
    gl.glDisable(GL10.GL_LIGHTING);
    gl.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE);
    jetTexture.bind();
    // gl.glPushMatrix();
    for (int i = 0; i < Stardust3d.shipdefs.size(); i++) {
        String currentShipdef = Stardust3d.shipdefs.get(i).getModel().substring(0,
                Stardust3d.shipdefs.get(i).getModel().length() - 4);
        if (Stardust3d.DEEPDEBUG)
            System.out.println("shipdef " + currentShipdef);
        if (currentShipdef.equals(shipname)) {
            if (Stardust3d.shipdefs.get(i).getJet1x() != 99999) {
                gl.glTranslatef(Stardust3d.shipdefs.get(i).getJet1x(), Stardust3d.shipdefs.get(i).getJet1y(),
                        Stardust3d.shipdefs.get(i).getJet1z());
                gl.glScalef(2f, 2f, (1f + length + noise));
                jetMesh.render(GL10.GL_TRIANGLES);
                gl.glScalef(.5f, .5f, 1 / (1f + length + noise));
                gl.glTranslatef(-Stardust3d.shipdefs.get(i).getJet1x(), -Stardust3d.shipdefs.get(i).getJet1y(),
                        -Stardust3d.shipdefs.get(i).getJet1z());
                // gl.glScalef(1, 1, 1);
            }
            if (Stardust3d.shipdefs.get(i).getJet2x() != 99999) {
                gl.glTranslatef(Stardust3d.shipdefs.get(i).getJet2x(), Stardust3d.shipdefs.get(i).getJet2y(),
                        Stardust3d.shipdefs.get(i).getJet2z());
                gl.glScalef(2f, 2f, (1f + length + noise));
                jetMesh.render(GL10.GL_TRIANGLES);
            }
            if (Stardust3d.shipdefs.get(i).getJet3x() != 99999) {
                gl.glTranslatef(Stardust3d.shipdefs.get(i).getJet3x(), Stardust3d.shipdefs.get(i).getJet3y(),
                        Stardust3d.shipdefs.get(i).getJet3z());
                gl.glScalef(2f, 2f, (1f + length + noise));
                jetMesh.render(GL10.GL_TRIANGLES);
            }
            if (Stardust3d.shipdefs.get(i).getJet4x() != 99999) {
                gl.glTranslatef(Stardust3d.shipdefs.get(i).getJet4x(), Stardust3d.shipdefs.get(i).getJet4y(),
                        Stardust3d.shipdefs.get(i).getJet4z());
                gl.glScalef(2f, 2f, (1f + length + noise));
                jetMesh.render(GL10.GL_TRIANGLES);
            }
            if (Stardust3d.shipdefs.get(i).getJet5x() != 99999) {
                gl.glTranslatef(Stardust3d.shipdefs.get(i).getJet5x(), Stardust3d.shipdefs.get(i).getJet5y(),
                        Stardust3d.shipdefs.get(i).getJet5z());
                gl.glScalef(2f, 2f, (1f + length + noise));
                jetMesh.render(GL10.GL_TRIANGLES);
            }
        }
    }
    gl.glEnable(GL10.GL_CULL_FACE);
    gl.glDisable(GL10.GL_BLEND);
    gl.glEnable(GL10.GL_LIGHTING);
}

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

License:Open Source License

@SuppressWarnings("unused")
private void renderDrones(GL10 gl, ArrayList<Drone> drones, Application app, Ship ship) {
    if (ship.isExploding)
        return;//from   w  w w  .ja v a 2  s. c o m
    // invaderTexture.bind();
    for (int i = 0; i < drones.size(); i++) {
        Drone drone = drones.get(i);
        gl.glPushMatrix();
        gl.glScalef(.25f, .25f, .25f);

        gl.glTranslatef(drone.position.x, drone.position.y, drone.position.z);

        // invaderMesh.render(GL10.GL_TRIANGLES);
        gl.glPopMatrix();

    }

}

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

License:Open Source License

private void renderSky(GL10 gl, Ship ship, Application app) {

    gl.glDisable(GL10.GL_LIGHTING);//from ww w  .  j av  a  2 s  .  c o  m
    skyTexture.bind();
    gl.glColor4f(1, 1, 1, 1);

    gl.glPushMatrix();
    gl.glTranslatef(Ship.position.x, Ship.position.y, Ship.position.z);
    gl.glScalef(155f, 155f, 155f);
    skyMesh.render(GL10.GL_TRIANGLES);
    gl.glPopMatrix();
    gl.glEnable(GL10.GL_LIGHTING);
}

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

License:Open Source License

private void renderPlanet(GL10 gl, String texture, boolean uvtype, float radius, float x, float y, float z) {
    radius = radius * worldscale;/*w w w.jav  a 2s.  c o m*/

    if (texture.equals("earth")) {
        // render earth/jupiter texture
        planetTexture.bind();
    } else if (texture.equals("sun")) {
        // render mars/sun texture
        planetTexture02.bind();
    }

    gl.glPushMatrix();
    // move away from origin
    gl.glTranslatef(x, y, z);
    // scale to 10% size of earth
    gl.glScalef(radius, radius, radius);

    if (uvtype == true) {
        // render lower planet texture
        planetMesh.render(GL10.GL_TRIANGLES);
    } else {
        // render upper planet texture
        planetMesh02.render(GL10.GL_TRIANGLES);
    }
    gl.glPopMatrix();

}

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

License:Open Source License

private void renderStation(GL10 gl, String texture, boolean uvtype, float radius, float x, float y, float z) {
    radius = radius * worldscale;//from   w w  w.  j av  a  2  s  .c om

    if (texture.equals("station01")) {
        // render earth/jupiter texture
        stationTexture.bind();
    } else if (texture.equals("sun")) {
        // render mars/sun texture
        planetTexture02.bind();
    }
    // render station
    gl.glPushMatrix();
    // move away from origin
    gl.glTranslatef(x, y, z);
    // scale to 10% size of earth
    gl.glScalef(radius, radius, radius);
    gl.glRotatef(Station.yawAngle, 0, 1, 0);
    stationMesh.render(GL10.GL_TRIANGLES);
    gl.glPopMatrix();

    // render station forcefield
    // gl.glPushMatrix();
    // rendermode for glow

    // gl.glEnable(GL10.GL_BLEND);
    // gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE);
    // gl.glPushMatrix();
    // gl.glDisable(GL10.GL_LIGHTING);
    // gridTexture.bind();
    // gl.glColor4f(.5f, .5f, 1f, 1f);
    // gl.glScalef(radius * 1.2f, radius * 1.2f, radius * 1.2f);
    // doubleside render
    // gl.glDisable(GL10.GL_CULL_FACE);
    // gl.glRotatef(-Station.yawAngle, 0, 1, 0);
    // moonMesh.render(GL10.GL_TRIANGLES);
    // gl.glPopMatrix();
    // gl.glColor4f(1, 1, 1, 1);
    // doubleside render off
    // gl.glEnable(GL10.GL_CULL_FACE);
    // gl.glEnable(GL10.GL_LIGHTING);
}

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

License:Open Source License

private void renderSun(GL10 gl, float radius, float x, float y, float z, Application app) {

    gl.glDisable(GL10.GL_LIGHTING);//from w  w  w  .  j ava2 s. co m
    radius = radius * worldscale;
    planetTexture02.bind();
    gl.glPushMatrix();
    // move away from origin
    gl.glTranslatef(x, y, z);
    // scale to size of earth
    gl.glScalef(radius, radius, radius);
    planetMesh02.render(GL10.GL_TRIANGLES);
    gl.glPopMatrix();
    gl.glEnable(GL10.GL_LIGHTING);
}

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

License:Open Source License

@SuppressWarnings("unused")
private void renderMoon(GL10 gl, float radius, float x, float y, float z) {
    radius = radius * worldscale;//from  w  w w  .  j  a  v a  2  s  .  co  m
    moonTexture.bind();
    gl.glPushMatrix();
    // move away from origin
    gl.glTranslatef(x, y, z);
    // scale to size of moon
    gl.glScalef(radius, radius, radius);
    moonMesh.render(GL10.GL_TRIANGLES);
    gl.glPopMatrix();

}