Пример #1
0
  @Override
  public void render(float delta) {
    if (this.handleInput(delta)) {
      myGame.setScreen(BaseGame.screens.get("main"));
      return;
    }

    // Make a black background
    if (Settings.getRetro()) {
      GL10 g1 = Gdx.graphics.getGL10();
      Gdx.gl.glClearColor(0, 0, 0, 1);
      g1.glClear(GL20.GL_COLOR_BUFFER_BIT);
    } else {
      GL10 g1 = Gdx.graphics.getGL10();
      Gdx.gl.glClearColor(.19f, .19f, .19f, 1f);
      g1.glClear(GL20.GL_COLOR_BUFFER_BIT);
    }

    float dpi = Gdx.graphics.getDensity() * 160f;
    float inchHeight = ((float) Gdx.graphics.getHeight()) / dpi;

    spriteBatch.begin();
    font.setScale(2 * dpi * (inchHeight / 22f) / 72f);
    font.draw(spriteBatch, "High Scores", xx * .40f, yy * .98f);
    font.setScale(dpi * (inchHeight / 22f) / 72f);
    for (int i = 0; i < 10; i++) {
      font.draw(spriteBatch, scores[i][0], xx * .05f, yy * (.85f - i * .08f));
      font.draw(spriteBatch, scores[i][1], xx * .20f, yy * (.85f - i * .08f));
      font.draw(spriteBatch, scores[i][2], xx * .70f, yy * (.85f - i * .08f));
    }
    spriteBatch.end();
  }
  @Override
  public void render(float delta) {
    // TODO Auto-generated method stub

    if (Gdx.input.justTouched()) {
      guiCam.unproject(touch.set(Gdx.input.getX(), Gdx.input.getY(), 0));
      if (startbutton.contains(touch)) {
        maingame.setScreen(maingame.mainscene);
        return;
      }
    }

    GL10 gl = Gdx.graphics.getGL10();
    gl.glClearColor(0, 0, 0, 1);
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    /*
     * Actualiza los parametros de la camara
     * y los enlaza al objeto de renderizado batcher
     * */
    guiCam.update();
    this.batcher.setProjectionMatrix(this.guiCam.combined);
    /*
     * Desactiva las trasnparencias
     * */
    batcher.disableBlending();
    batcher.begin();
    batcher.draw(Assets.background, 0, 0, 10, 15);
    batcher.end();
    batcher.enableBlending();
    batcher.begin();
    batcher.draw(Assets.title, 1, 6, 8, 8);
    batcher.draw(Assets.start, x, 3, 6, 3);
    x += c;
    batcher.end();
  }
Пример #3
0
  private void renderPlanet(
      GL10 gl,
      String texture,
      boolean uvtype,
      float radius,
      float x,
      float y,
      float z,
      Application app) {
    radius = radius * worldscale;

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

    gl.glPushMatrix();
    // move away from origin
    gl.glTranslatef(x, y, z);
    // scale to 10% size of earth
    gl.glScalef(radius, radius, radius);
    gl.glRotatef((Splash.planetmove / 10) - 180, 0, 1, 0);
    if (uvtype == true) {
      // render lower planet texture
      planetMesh.render(GL10.GL_TRIANGLES);
    } else {
      // render upper planet texture
      planetMesh02.render(GL10.GL_TRIANGLES);
    }
    gl.glPopMatrix();
  }
Пример #4
0
  private void setStaticProjectionAndCamera(Graphics graphics, Application app, GL10 gl) {
    gl.glMatrixMode(GL10.GL_PROJECTION);
    gl.glLoadIdentity();
    // x=left-right, y=up-down, z=back-forward
    camera.far = 1000000;
    camera.position.set(0, 7f + 0, 9f + 0);
    // camera.direction.set(0, 0, -4f).sub(camera.position).nor();
    camera.fieldOfView = 67;
    float orbitRadius = (new Vector3(0, 0, 0).dst(camera.position));
    camera.position.set(new Vector3(0, 0, 0));

    camera.rotate(Splash.cameraHorizAngle, 0, 1, 0);
    Vector3 orbitReturnVector = new Vector3(0, 0, 0);
    orbitReturnVector.set(camera.direction.tmp().mul(-orbitRadius));
    camera.translate(orbitReturnVector.x, orbitReturnVector.y, orbitReturnVector.z);
    camera.update();
    camera.apply(gl);

    orbitRadius = (new Vector3(0, 0, 0)).dst(camera.position);
    camera.position.set(new Vector3(0, 0, 0));
    camera.rotate(Splash.cameraVertAngle, 1, 0, 0);
    orbitReturnVector = new Vector3(0, 0, 0);
    orbitReturnVector.set(camera.direction.tmp().mul(-orbitRadius));
    camera.translate(orbitReturnVector.x, orbitReturnVector.y, orbitReturnVector.z);
    camera.update();
    camera.apply(gl);
    gl.glMatrixMode(GL10.GL_MODELVIEW);
    Splash.cameraHorizAngle = 0;
    Splash.cameraVertAngle = 0;
  }
Пример #5
0
  @Override
  public void render() {
    GL10 gl = Gdx.app.getGraphics().getGL10();

    gl.glClearColor(r, g, b, 1);
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
  }
Пример #6
0
  private void setLighting(GL10 gl) {
    gl.glEnable(GL10.GL_LIGHTING);
    gl.glEnable(GL10.GL_LIGHT0);

    gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_AMBIENT, new float[] {0.25f, 0.25f, 0.29f, 1f}, 0);
    gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_DIFFUSE, new float[] {0.99f, 0.99f, 0.79f, 1f}, 0);
    // bright yellow light
    gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_SPECULAR, new float[] {.9f, .9f, 1f, 1f}, 0);

    gl.glEnable(GL10.GL_COLOR_MATERIAL);
  }
Пример #7
0
  /**
   * @param simulation
   * @param gl
   */
  private void renderHud(GL10 gl) {
    gl.glDisable(GL10.GL_CULL_FACE);
    gl.glDisable(GL10.GL_DEPTH_TEST);
    int width = Gdx.app.getGraphics().getWidth();
    int height = Gdx.app.getGraphics().getHeight();
    // spriteBatch.setProjectionMatrix(viewMatrix);
    // spriteBatch.setTransformMatrix(transformMatrix);

    spriteBatch.begin();
    spriteBatch.enableBlending();
    spriteBatch.setBlendFunction(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);

    /*A minimum of dataset
    B maximum of dataset
    a is from where you would like normalised data set to start
    b is where you would like normalised data set to end
    x is the value you are trying to normalise
    a + (x-A)*(b-a)/(B-A)

    */

    float length = 0 + (progress - 0) * ((Gdx.graphics.getWidth() / 10) * 8 - 0) / (1 - 0);
    spriteBatch.setColor(0, 0, 1, 1);
    spriteBatch.draw(
        progressBarTexture,
        Gdx.graphics.getWidth() / 10,
        110,
        (Gdx.graphics.getWidth() / 10) * 8,
        30);
    spriteBatch.setColor(0, 1, 1, 1);
    spriteBatch.draw(progressBarTexture, (Gdx.graphics.getWidth() / 10) + 2, 112, length, 26);
    spriteBatch.setColor(1, 1, 1, 1);
    font.draw(spriteBatch, "Version:" + BattleBeasties3d.version, 10, 10);
    font.draw(spriteBatch, "Loading " + String.format("%.0f", progress * 100) + "%", 100, 100);
    if (Splash.fadeIn) {
      spriteBatch.setColor(0, 0, 0, Splash.fadeTimer);
      spriteBatch.draw(xfadeTexture, 0, 0, width, height);
    }
    if (Splash.fadeOut) {
      spriteBatch.setColor(1, 1, 1, Splash.fadeTimer);
      spriteBatch.draw(xfadeTexture, 0, 0, width, height);
    }
    spriteBatch.setColor(1, 1, 1, 1);
    if (BattleBeasties3d.Error == BattleBeasties3d.NETWORK_DOWN && netErrorShown == false) {
      stage.addActor(
          Actors.bottomToast(
              "Connection to internet failed, Please check your network is working.", 5, skin));

      netErrorShown = true;
    }

    spriteBatch.end();
  }
Пример #8
0
  private void renderStaticShip(GL10 gl, Application app) {

    shipTexture.bind();
    gl.glPushMatrix();
    gl.glTranslatef(0, 0, 0);
    shipMesh.render(GL10.GL_TRIANGLES);
    gl.glPopMatrix();
    float noise = (float) Math.random() / 2;
    renderJet(gl, 2.3f, 1f + noise, 1.1f, -.5f, 1.8f, app);
    noise = (float) Math.random() / 2;
    renderJet(gl, 2.3f, 1f + noise, -1.1f, -.5f, 1.8f, app);
  }
Пример #9
0
  @Override
  public void render(float delta) {
    GL10 gl = Gdx.graphics.getGL10();

    // Update model
    gameLogic.update((int) (delta * 1000.0f));

    // clear previous frame
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

    stage.act(delta);
    stage.draw();
  }
Пример #10
0
    public void update() {
      dynamicsWorld.stepSimulation(Gdx.graphics.getDeltaTime(), 5);

      GL10 gl = Gdx.gl10;

      for (int i = 0; i < entities.size; i++) {
        final Entity entity = entities.get(i);
        gl.glPushMatrix();
        gl.glMultMatrixf(entity.worldTransform.transform.val, 0);
        gl.glColor4f(entity.color.r, entity.color.g, entity.color.b, entity.color.a);
        entity.mesh.render(GL10.GL_TRIANGLES);
        gl.glPopMatrix();
      }
    }
Пример #11
0
  @Override
  public void render() {
    GL10 gl = Gdx.gl10;
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
    gl.glEnable(GL10.GL_DEPTH_TEST);
    gl.glDepthFunc(GL10.GL_LEQUAL);
    gl.glEnable(GL10.GL_COLOR_MATERIAL);
    gl.glEnable(GL10.GL_LIGHTING);
    gl.glEnable(GL10.GL_LIGHT0);
    gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_AMBIENT, lightAmbient, 0);
    gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_POSITION, lightPosition, 0);
    gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_DIFFUSE, lightDiffuse, 0);

    camera.apply(Gdx.gl10);

    world.update();
  }
  @Override
  public void render() {
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

    spriteBatch.setProjectionMatrix(worldCamera.projection);
    spriteBatch.setTransformMatrix(worldCamera.view);
    spriteBatch.begin();
    farmSprite.draw(spriteBatch);
    spriteBatch.end();

    shapeRenderer.setProjectionMatrix(worldCamera.projection);
    shapeRenderer.setTransformMatrix(worldCamera.view);

    shapeRenderer.setColor(1f, 1f, 1f, 1f);
    shapeRenderer.begin(ShapeType.Line);
    for (int i = 0; i < convexHull2d.getPointsCount(); i++) {
      float x0 = convexHull2d.getX(i);
      float y0 = convexHull2d.getY(i);
      if (i + 1 == convexHull2d.getPointsCount()) {
        float x1 = convexHull2d.getX(0);
        float y1 = convexHull2d.getY(0);
        shapeRenderer.line(x0, y0, x1, y1);
        break;
      }
      float x1 = convexHull2d.getX(i + 1);
      float y1 = convexHull2d.getY(i + 1);
      shapeRenderer.line(x0, y0, x1, y1);
    }
    shapeRenderer.end();

    shapeRenderer.setColor(0f, 1f, 1f, 1f);
    shapeRenderer.begin(ShapeType.Line);
    for (int i = 0; i < smallConvexHull2d.getPointsCount(); i++) {
      float x0 = smallConvexHull2d.getX(i);
      float y0 = smallConvexHull2d.getY(i);
      if (i + 1 == smallConvexHull2d.getPointsCount()) {
        float x1 = smallConvexHull2d.getX(0);
        float y1 = smallConvexHull2d.getY(0);
        shapeRenderer.line(x0, y0, x1, y1);
        break;
      }
      float x1 = smallConvexHull2d.getX(i + 1);
      float y1 = smallConvexHull2d.getY(i + 1);
      shapeRenderer.line(x0, y0, x1, y1);
    }
    shapeRenderer.end();

    shapeRenderer.setColor(1f, 0f, 0f, 1f);
    shapeRenderer.begin(ShapeType.FilledCircle);
    for (int i = 0; i < convexHull2d.getPointsCount(); i++) {
      float x = convexHull2d.getX(i);
      float y = convexHull2d.getY(i);
      shapeRenderer.filledCircle(x, y, 1f, 5);
    }
    shapeRenderer.end();
  }
Пример #13
0
 private void setupMatrices() {
   if (!Gdx.graphics.isGL20Available()) {
     GL10 gl = Gdx.gl10;
     gl.glMatrixMode(GL10.GL_PROJECTION);
     gl.glLoadMatrixf(projectionMatrix.val, 0);
     gl.glMatrixMode(GL10.GL_MODELVIEW);
     gl.glLoadMatrixf(transformMatrix.val, 0);
   } else {
     combinedMatrix.set(projectionMatrix).mul(transformMatrix);
     if (customShader != null) {
       customShader.setUniformMatrix("u_proj", projectionMatrix);
       customShader.setUniformMatrix("u_trans", transformMatrix);
       customShader.setUniformMatrix("u_projTrans", combinedMatrix);
       customShader.setUniformi("u_texture", 0);
     } else {
       shader.setUniformMatrix("u_projectionViewMatrix", combinedMatrix);
       shader.setUniformi("u_texture", 0);
     }
   }
 }
Пример #14
0
  /** Dibuja en pantalla, lo que se cargo previamente en el metodo cargar, de esta clase. */
  public void Render() {
    GL10 gl = Gdx.gl10;
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

    gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
    for (int i = 0; i < LAYERS; i++) {
      SpriteCache cache = caches[i];
      cache.setProjectionMatrix(cam.combined);
      cache.begin();
      for (int j = 0; j < TILES_PER_LAYER; j += BLOCK_TILES) {
        cache.draw(layers[i], j, BLOCK_TILES);
      }
      cache.end();
    }

    if (System.nanoTime() - startTime >= 1000000000) {
      // Gdx.app.log("TileTest", "fps: " + Gdx.graphics.getFramesPerSecond());
      startTime = System.nanoTime();
    }
  }
 public void render() {
   spriteBatch
       .getProjectionMatrix()
       .setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
   float delta = Gdx.graphics.getDeltaTime();
   GL10 gl = Gdx.graphics.getGL10();
   gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
   spriteBatch.begin();
   effect.draw(spriteBatch, delta);
   spriteBatch.end();
   fpsCounter += delta;
   if (fpsCounter > 3) {
     fpsCounter = 0;
     int activeCount = emitters.get(emitterIndex).getActiveCount();
     System.out.println(
         activeCount
             + "/"
             + particleCount
             + " particles, FPS: "
             + Gdx.graphics.getFramesPerSecond());
   }
 }
Пример #16
0
  private void renderSky(GL10 gl) {

    gl.glDisable(GL10.GL_LIGHTING);
    skyTexture.bind();
    gl.glColor4f(1, 1, 1, 1);

    gl.glPushMatrix();
    gl.glTranslatef(0, 0, 0);
    gl.glScalef(100f, 100f, 100f);
    skyMesh.render(GL10.GL_TRIANGLES);
    gl.glPopMatrix();
    gl.glEnable(GL10.GL_LIGHTING);
  }
Пример #17
0
 /**
  * render ship jets
  *
  * @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);
 }
Пример #18
0
 public void render(GL10 gl) {
   gl.glPushMatrix();
   gl.glTranslatef(position.x, position.y, -50);
   mesh.render(GL10.GL_TRIANGLE_STRIP);
   gl.glPopMatrix();
 }
Пример #19
0
  @Override
  public void render() {
    GL10 gl = Gdx.graphics.getGL10();
    gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    gl.glClearColor(0.7f, 0.7f, 0.7f, 1);
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    gl.glMatrixMode(GL10.GL_MODELVIEW);
    gl.glLoadIdentity();
    gl.glRotatef(angle, 0, 0, 1);
    angle += angleIncrement;
    gl.glEnable(GL10.GL_TEXTURE_2D);

    gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
    vertices.position(0);
    gl.glColorPointer(4, GL10.GL_FLOAT, BYTES_PER_VERTEX, vertices);

    gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
    gl.glClientActiveTexture(GL10.GL_TEXTURE0);
    gl.glActiveTexture(GL10.GL_TEXTURE0);
    tex.bind();
    vertices.position(4);
    gl.glTexCoordPointer(2, GL10.GL_FLOAT, BYTES_PER_VERTEX, vertices);

    gl.glClientActiveTexture(GL10.GL_TEXTURE1);
    gl.glActiveTexture(GL10.GL_TEXTURE1);
    tex2.bind();
    vertices.position(6);
    gl.glTexCoordPointer(2, GL10.GL_FLOAT, BYTES_PER_VERTEX, vertices);

    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    vertices.position(8);
    gl.glVertexPointer(3, GL10.GL_FLOAT, BYTES_PER_VERTEX, vertices);

    gl.glDrawArrays(GL10.GL_TRIANGLES, 0, 3);
  }
Пример #20
0
  private void renderSun(GL10 gl, float radius, float x, float y, float z, Application app) {

    gl.glDisable(GL10.GL_LIGHTING);
    radius = radius * worldscale;
    sunTexture.bind();
    gl.glPushMatrix();
    // move away from origin
    gl.glTranslatef(x, y, z);
    // scale to size of earth
    gl.glScalef(radius, radius, radius);
    gl.glDisable(GL10.GL_CULL_FACE);

    gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE);
    gl.glPushMatrix();
    gl.glDisable(GL10.GL_LIGHTING);
    // gl.glRotatef((Splash.planetmove/10), .25f, .75f, .5f);
    sunMesh.render(GL10.GL_TRIANGLES);
    gl.glPopMatrix();
    gl.glEnable(GL10.GL_LIGHTING);
    gl.glEnable(GL10.GL_CULL_FACE);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
  }
Пример #21
0
 public void enable(GL10 gl) {
   gl.glLightModelfv(GL10.GL_LIGHT_MODEL_AMBIENT, color, 0);
 }
Пример #22
0
 @Override
 public void resize(int w, int h) {
   // set OpenGL viewport
   GL10 gl = Gdx.app.getGraphics().getGL10();
   gl.glViewport(0, 0, w, h);
 }
 @Override
 public void render(float delta, GL10 gl) {
   gl.glClearColor(1, 0, 0, 1);
   gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
 }
Пример #24
0
 private void renderInsideStation(Application app) {
   GL10 gl = app.getGraphics().getGL10();
   gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
   gl.glViewport(0, 0, app.getGraphics().getWidth(), app.getGraphics().getHeight());
   gl.glEnable(GL10.GL_BLEND);
   gl.glDisable(GL10.GL_DITHER);
   gl.glEnable(GL10.GL_DEPTH_TEST);
   gl.glEnable(GL10.GL_CULL_FACE);
   setStaticProjectionAndCamera(app.getGraphics(), app, gl);
   setLighting(gl);
   gl.glEnable(GL10.GL_TEXTURE_2D);
   renderSky(gl);
   renderPlanet(gl, "sun", true, 1737f, Splash.planetmove - 150, 0, -2500, app);
   renderSky(gl);
   gl.glDisable(GL10.GL_DITHER);
   gl.glDisable(GL10.GL_CULL_FACE);
   // do alpha models after this
   renderStaticShip(gl, app);
   renderSun(gl, 70000f, -1600, 0, -4500, app);
   gl.glDisable(GL10.GL_TEXTURE_2D);
   renderHud(gl);
 }
Пример #25
0
 @Override
 public void render() {
   GL10 gl = Gdx.graphics.getGL10();
   gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
 }
Пример #26
0
  /**
   * This method is responsible for OpenGL rendering mechanism. Adds lighting to the world. Checks
   * rigidBody map for proper collisionshapes (like SphereShape or BoxShape).
   */
  public void render(float delta) {
    float[] light_ambient = new float[] {1.5f, 1.5f, 1.5f, 1.5f};
    float[] light_diffuse = new float[] {1.0f, 1.0f, 1.0f, 1.0f};
    float[] light_specular = new float[] {1.0f, 1.0f, 1.0f, 1.0f};
    float[] light_position0 = new float[] {1.0f, 10.0f, 1.0f, 0.0f};
    light_position0[0] = position.x + 10;
    light_position0[1] = position.y;
    light_position0[2] = position.z;
    float x = 0.0f, z = 0.0f;

    GL10 gl = Gdx.graphics.getGL10();
    deltaTime = Gdx.graphics.getDeltaTime();

    Gdx.gl.glClearColor(0.0f, 0.0f, 0.0f, 1);
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

    Gdx.graphics.getGL11().glLightfv(GL10.GL_LIGHT0, GL10.GL_AMBIENT, light_ambient, 0);
    Gdx.graphics.getGL11().glLightfv(GL10.GL_LIGHT0, GL10.GL_DIFFUSE, light_diffuse, 0);
    Gdx.graphics.getGL11().glLightfv(GL10.GL_LIGHT0, GL10.GL_SPECULAR, light_specular, 0);
    Gdx.graphics.getGL11().glLightfv(GL10.GL_LIGHT0, GL10.GL_POSITION, light_position0, 0);

    Gdx.graphics.getGL11().glEnable(GL10.GL_LIGHTING);
    Gdx.graphics.getGL11().glEnable(GL10.GL_LIGHT0);

    Gdx.gl.glEnable(GL10.GL_DEPTH_TEST);

    Gdx.gl.glEnable(GL10.GL_CULL_FACE);
    Gdx.gl.glEnable(GL10.GL_TEXTURE_2D);

    startTime = System.nanoTime();
    rigidBody = physics.doSimulation(deltaTime, 1);
    endTime = (System.nanoTime() - startTime) / 1000000000.0f;

    for (RigidBody body : rigidBody.values()) {

      if (body.geometry.shape.getType() == ShapeType.BOX_SHAPE_PROXYTYPE) {
        gl.glPushMatrix();

        body.motionState.resultSimulation.getOpenGLMatrix(glMat);
        gl.glMultMatrixf(glMat, 0);

        wallShapeZ = (BoxShape) body.geometry.shape;

        wood.bind();
        gl.glRotatef(270, 1, 0, 0);
        gl.glScalef(7, 7, 7);
        wall.render(GL10.GL_TRIANGLES);
        gl.glPopMatrix();
      }

      if (body.geometry.shape.getType() == ShapeType.STATIC_PLANE_PROXYTYPE) {
        gl.glPushMatrix();

        body.motionState.resultSimulation.getOpenGLMatrix(glMat);
        gl.glMultMatrixf(glMat, 0);

        groundShape = (StaticPlaneShape) body.geometry.shape;

        stone.bind();
        gl.glRotatef(270, 1, 0, 0);
        gl.glScalef(6f, 6f, 6f);
        plane.render(GL10.GL_TRIANGLES);
        gl.glPopMatrix();
      }

      if (body.geometry.shape.getType() == ShapeType.SPHERE_SHAPE_PROXYTYPE) {

        gl.glPushMatrix();

        sphereMovement(body);

        body.motionState.resultSimulation.getOpenGLMatrix(glMat);
        gl.glMultMatrixf(glMat, 0);

        x = body.motionState.resultSimulation.originPoint.x;
        z = body.motionState.resultSimulation.originPoint.z;

        if ((x >= 19.0 && x <= 26.5) && (z >= 8.4 && z <= 8.6)) {
          Gdx.app.log("Zwyciestwo", "lolol");
        }

        if (indexior == 0) black.bind();
        else if (indexior == 1) green.bind();
        else if (indexior == 2) pink.bind();
        else if (indexior == 3) steel.bind();
        else if (indexior == 4) maja.bind();

        sphere.render(GL10.GL_TRIANGLES);
        gl.glPopMatrix();
        cameraSetup(body);
      }
    }

    if (Gdx.input.justTouched()) {
      FileHandle fh = Gdx.files.local("ala.txt");
      fh.writeString(
          String.valueOf(x) + " " + String.valueOf(z) + " " + String.valueOf(indexior), false);
      game.setScreen(new MenuScreen(game));
    }

    gl.glPushMatrix();
    gl.glTranslatef(22.0f, -10.0f, 8.5f);
    gl.glScalef(1.0f, 1.0f, 1.0f);
    gl.glRotatef(270, 1, 0, 0);
    aim.bind();
    target.render(GL10.GL_TRIANGLES);
    gl.glPopMatrix();

    gl.glDisable(GL10.GL_CULL_FACE);
    gl.glDisable(GL10.GL_DEPTH_TEST);
  }