List of usage examples for com.badlogic.gdx.graphics GL10 GL_DEPTH_BUFFER_BIT
int GL_DEPTH_BUFFER_BIT
To view the source code for com.badlogic.gdx.graphics GL10 GL_DEPTH_BUFFER_BIT.
Click Source Link
From source file:com.badlogic.gdx.tests.DecalTransform.java
License:Apache License
@Override public void render() { Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); Gdx.gl10.glLoadIdentity();/*from w ww .j a v a 2 s.c o m*/ Gdx.gl10.glScalef(0.02f, 0.02f, 1); int n = 0; float elapsed = Gdx.graphics.getDeltaTime(); float translate = timePassed > 0.5 ? (float) Math.random() - timePassed / 2 : (float) Math.random() / 2 + timePassed / 2; translate *= (-0.5 + Math.random()); cam.update(); cam.apply(Gdx.gl10); Action a = keyActions.get(key); for (int i = 0; i < DECAL_COUNT; i++) { batch.add(sprites[n]); if (a != null) { a.perform(sprites[n]); } } batch.flush(); timePassed += elapsed; if (timePassed > 1.0f) { timePassed = 0; } }
From source file:com.badlogic.gdx.tests.HelloWorld.java
License:Apache License
@Override public void create() { gl = Gdx.gl10;/*from ww w. j a va 2 s.c o m*/ gl.glDisable(GL10.GL_DEPTH_TEST); // gl.glEnable(GL10.GL_DEPTH_TEST); // gl.glDisable(GL10.GL_TEXTURE_2D); gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); gl.glClearColor(0, 0, 0, 1); font = new BitmapFont(); font.setColor(Color.RED); texture = new Texture(Gdx.files.internal("data/badlogic.jpg")); spriteBatch = new SpriteBatch(); }
From source file:com.badlogic.gdx.tests.HelloWorld.java
License:Apache License
@Override public void render() { int centerX = Gdx.graphics.getWidth() / 2; int centerY = Gdx.graphics.getHeight() / 2; gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); // more fun but confusing :) //textPosition.add(textDirection.tmp().mul(Gdx.graphics.getDeltaTime()).mul(60)); textPosition.x += textDirection.x * Gdx.graphics.getDeltaTime() * 60; textPosition.y += textDirection.y * Gdx.graphics.getDeltaTime() * 60; if (textPosition.x < 0) { textDirection.x = -textDirection.x; textPosition.x = 0;/*www. j a v a 2 s .c o m*/ } if (textPosition.x > Gdx.graphics.getWidth()) { textDirection.x = -textDirection.x; textPosition.x = Gdx.graphics.getWidth(); } if (textPosition.y < 0) { textDirection.y = -textDirection.y; textPosition.y = 0; } if (textPosition.y > Gdx.graphics.getHeight()) { textDirection.y = -textDirection.y; textPosition.y = Gdx.graphics.getHeight(); } spriteBatch.begin(); // spriteBatch.setColor(Color.WHITE); spriteBatch.draw(texture, centerX - texture.getWidth() / 2, centerY - texture.getHeight() / 2, 0, 0, texture.getWidth(), texture.getHeight()); font.draw(spriteBatch, "Hello World!", (int) textPosition.x, (int) textPosition.y); spriteBatch.end(); }
From source file:com.badlogic.rtm.LevelRenderer.java
License:Apache License
@Override public void render() { GL10 gl = Gdx.gl10;//from w ww. j ava 2 s . c o m gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); gl.glEnable(GL10.GL_DEPTH_TEST); gl.glEnable(GL10.GL_TEXTURE_2D); camera.update(); camera.apply(gl); tiles.bind(); gl.glColor4f(1, 1, 1, 1); floorMesh.render(GL10.GL_TRIANGLES); wallMesh.render(GL10.GL_TRIANGLES); batch.begin(); batch.setBlendFunction(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA); font.draw(batch, "fps: " + Gdx.graphics.getFramesPerSecond() + ", delta:" + Gdx.graphics.getDeltaTime(), 10, 25); batch.end(); processInput(); }
From source file:com.davidykay.shootout.Renderer.java
License:Apache License
public void render(Application app, Simulation simulation) { 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()); renderBackground(gl);/*from w ww . ja va2 s . c o m*/ renderEarth(gl); gl.glDisable(GL10.GL_DITHER); gl.glEnable(GL10.GL_DEPTH_TEST); gl.glEnable(GL10.GL_CULL_FACE); //setProjectionAndCamera(app.getGraphics(), simulation.ship, app); setProjectionAndCameraAugmentedReality(app.getGraphics(), simulation, app); setLighting(gl); gl.glEnable(GL10.GL_TEXTURE_2D); renderMoon(gl, simulation.ship); renderShip(gl, simulation.ship, app); renderAliens(gl, simulation.aliens); gl.glDisable(GL10.GL_TEXTURE_2D); renderBlocks(gl, simulation.blocks); gl.glDisable(GL10.GL_LIGHTING); //renderShots(gl, simulation.shots); //renderRays(gl, simulation.mRays, true); renderAlienRays(gl, simulation.mAlienRays); renderPlayerRays(gl, simulation.mShipRays); gl.glEnable(GL10.GL_TEXTURE_2D); renderExplosions(gl, simulation.explosions); renderBombExplosions(gl, simulation.bombExplosions); gl.glDisable(GL10.GL_CULL_FACE); gl.glDisable(GL10.GL_DEPTH_TEST); spriteBatch.setProjectionMatrix(viewMatrix); spriteBatch.setTransformMatrix(transformMatrix); spriteBatch.begin(); if (simulation.ship.lives != lastLives || simulation.score != lastScore || simulation.wave != lastWave) { status = "lives: " + simulation.ship.lives + " wave: " + simulation.wave + " score: " + simulation.score; lastLives = simulation.ship.lives; lastScore = simulation.score; lastWave = simulation.wave; } spriteBatch.enableBlending(); spriteBatch.setBlendFunction(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA); font.draw(spriteBatch, status, 0, 320); spriteBatch.end(); alienAngle += app.getGraphics().getDeltaTime() * 90; if (alienAngle > 360) alienAngle -= 360; }
From source file:com.davidykay.shootout.screens.GameLoop.java
License:Apache License
@Override public void render(Application app) { app.getGraphics().getGL10().glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); renderer.render(app, simulation); }
From source file:com.digitale.mygdxgame.Renderer.java
License:Open Source License
private void renderSolarSystem(Application app, Simulation simulation) { 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()); // renderBackground(gl); gl.glDisable(GL10.GL_DITHER);/* ww w. j a va 2 s.co m*/ gl.glEnable(GL10.GL_DEPTH_TEST); gl.glEnable(GL10.GL_CULL_FACE); setProjectionAndCamera(app.getGraphics(), Simulation.ship, app, gl); setLighting(gl); gl.glEnable(GL10.GL_TEXTURE_2D); // renderRoids(gl); // camera.unproject(GameLoop.touchPoint.set(Gdx.input.getX(), // Gdx.input.getY(), 0)); // render earth // renderPlanet(gl, "earth", true, 63780f, 200000, 0, 50000); // render mars renderPlanet(gl, "sun", true, 33970, 0, 0, 50000); // render sun renderSun(gl, 69550f, 0, 0, -500000, app); // render jupiter // renderPlanet(gl, "earth", false, 714920f, -4000000, 0, 50000); // render moon // renderMoon(gl, 17370f, 100000, 0, -50000); // renderDrones(gl, simulation.drones, app, Simulation.ship); renderSky(gl, Simulation.ship, app); renderActors(gl); // do alpha models after this // render station renderStation(gl, "station01", true, 1000f, 0, 0, 0); // render myship renderShip(gl, Simulation.ship, Stardust3d.myCharacter.getShipname()); renderDusts(gl, Simulation.dusts); renderShots(gl, simulation.shots); renderMissiles(gl, simulation.missiles); // renderTrails(gl, simulation.trails); gl.glDisable(GL10.GL_TEXTURE_2D); // renderBlocks(gl, simulation.blocks); // gl.glDisable(GL10.GL_LIGHTING); gl.glEnable(GL10.GL_TEXTURE_2D); renderExplosions(gl, Simulation.explosions); renderHud(simulation, gl); stationAngle += app.getGraphics().getDeltaTime() * 1; if (stationAngle > 360) stationAngle -= 360; invaderAngle += app.getGraphics().getDeltaTime() * 10; if (invaderAngle > 360) invaderAngle -= 360; }
From source file:com.digitale.mygdxgame.Renderer.java
License:Open Source License
private void renderInsideStation(Application app, Simulation simulation) { 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.glDisable(GL10.GL_DITHER);/*from w ww . j ava 2 s . co m*/ gl.glEnable(GL10.GL_DEPTH_TEST); setStaticProjectionAndCamera(app.getGraphics(), app, gl); setLighting(gl); gl.glEnable(GL10.GL_TEXTURE_2D); renderStaticShip(gl, Simulation.ship, app, Stardust3d.myCharacter.getShipname()); // renderDrones(gl, simulation.drones, app, Simulation.ship); gl.glDisable(GL10.GL_DITHER); gl.glEnable(GL10.GL_TEXTURE_2D); // do alpha models after this renderHangar(gl, Simulation.ship, app); gl.glDisable(GL10.GL_TEXTURE_2D); renderHud(simulation, gl); }
From source file:com.digitale.mygdxgame.SplashRenderer.java
License:Open Source License
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);//from w ww. j a v a 2s . c o m 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); }
From source file:com.digitale.screens.GameLoop.java
License:Open Source License
@Override public void render(float delta) { Gdx.app.getGraphics().getGL10().glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); renderer.render(Gdx.app, simulation); }