Java Code Examples for com.badlogic.gdx.graphics.GL20#glClear()

The following examples show how to use com.badlogic.gdx.graphics.GL20#glClear() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HelpScreen2.java    From ashley-superjumper with Apache License 2.0 6 votes vote down vote up
public void draw () {
	GL20 gl = Gdx.gl;
	gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
	guiCam.update();

	game.batcher.setProjectionMatrix(guiCam.combined);
	game.batcher.disableBlending();
	game.batcher.begin();
	game.batcher.draw(helpRegion, 0, 0, 320, 480);
	game.batcher.end();

	game.batcher.enableBlending();
	game.batcher.begin();
	game.batcher.draw(Assets.arrow, 320, 0, -64, 64);
	game.batcher.end();

	gl.glDisable(GL20.GL_BLEND);
}
 
Example 2
Source File: MainMenuScreen.java    From ashley-superjumper with Apache License 2.0 6 votes vote down vote up
public void draw () {
	GL20 gl = Gdx.gl;
	gl.glClearColor(1, 0, 0, 1);
	gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
	guiCam.update();
	game.batcher.setProjectionMatrix(guiCam.combined);

	game.batcher.disableBlending();
	game.batcher.begin();
	game.batcher.draw(Assets.backgroundRegion, 0, 0, 320, 480);
	game.batcher.end();

	game.batcher.enableBlending();
	game.batcher.begin();
	game.batcher.draw(Assets.logo, 160 - 274 / 2, 480 - 10 - 142, 274, 142);
	game.batcher.draw(Assets.mainMenu, 10, 200 - 110 / 2, 300, 110);
	game.batcher.draw(Settings.soundEnabled ? Assets.soundOn : Assets.soundOff, 0, 0, 64, 64);
	game.batcher.end();	
}
 
Example 3
Source File: HighscoresScreen.java    From ashley-superjumper with Apache License 2.0 6 votes vote down vote up
public void draw () {
	GL20 gl = Gdx.gl;
	gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
	guiCam.update();

	game.batcher.setProjectionMatrix(guiCam.combined);
	game.batcher.disableBlending();
	game.batcher.begin();
	game.batcher.draw(Assets.backgroundRegion, 0, 0, 320, 480);
	game.batcher.end();

	game.batcher.enableBlending();
	game.batcher.begin();
	game.batcher.draw(Assets.highScoresRegion, 10, 360 - 16, 300, 33);

	float y = 230;
	for (int i = 4; i >= 0; i--) {
		Assets.font.draw(game.batcher, highScores[i], xOffset, y);
		y += Assets.font.getLineHeight();
	}

	game.batcher.draw(Assets.arrow, 0, 0, 64, 64);
	game.batcher.end();
}
 
Example 4
Source File: HelpScreen3.java    From ashley-superjumper with Apache License 2.0 6 votes vote down vote up
public void draw () {
	GL20 gl = Gdx.gl;
	gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
	guiCam.update();

	game.batcher.setProjectionMatrix(guiCam.combined);
	game.batcher.disableBlending();
	game.batcher.begin();
	game.batcher.draw(helpRegion, 0, 0, 320, 480);
	game.batcher.end();

	game.batcher.enableBlending();
	game.batcher.begin();
	game.batcher.draw(Assets.arrow, 320, 0, -64, 64);
	game.batcher.end();

	gl.glDisable(GL20.GL_BLEND);
}
 
Example 5
Source File: HelpScreen.java    From ashley-superjumper with Apache License 2.0 6 votes vote down vote up
public void draw () {
	GL20 gl = Gdx.gl;
	gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
	gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
	
	guiCam.update();
	game.batcher.setProjectionMatrix(guiCam.combined);
	game.batcher.disableBlending();
	game.batcher.begin();
	game.batcher.draw(helpRegion, 0, 0);
	game.batcher.end();

	game.batcher.enableBlending();
	game.batcher.begin();
	game.batcher.draw(Assets.arrow, 320, 0, -64, 64);
	game.batcher.end();
}
 
Example 6
Source File: HelpScreen5.java    From ashley-superjumper with Apache License 2.0 6 votes vote down vote up
public void draw () {
	GL20 gl = Gdx.gl;
	gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
	guiCam.update();

	game.batcher.setProjectionMatrix(guiCam.combined);
	game.batcher.disableBlending();
	game.batcher.begin();
	game.batcher.draw(helpRegion, 0, 0, 320, 480);
	game.batcher.end();

	game.batcher.enableBlending();
	game.batcher.begin();
	game.batcher.draw(Assets.arrow, 320, 0, -64, 64);
	game.batcher.end();

	gl.glDisable(GL20.GL_BLEND);
}
 
Example 7
Source File: HelpScreen4.java    From ashley-superjumper with Apache License 2.0 6 votes vote down vote up
public void draw () {
	GL20 gl = Gdx.gl;
	gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
	guiCam.update();

	game.batcher.setProjectionMatrix(guiCam.combined);
	game.batcher.disableBlending();
	game.batcher.begin();
	game.batcher.draw(helpRegion, 0, 0, 320, 480);
	game.batcher.end();

	game.batcher.enableBlending();
	game.batcher.begin();
	game.batcher.draw(Assets.arrow, 320, 0, -64, 64);
	game.batcher.end();

	gl.glDisable(GL20.GL_BLEND);
}
 
Example 8
Source File: GdxScreen.java    From libGDX-Path-Editor with Apache License 2.0 6 votes vote down vote up
@Override
public void present(float deltaTime) {
	GL20 gl = Gdx.graphics.getGL20();
	gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
	gl.glClearColor(0.698f, 0.698f, 0.698f, 1f);
	
	camera.update();
	bgDrawer.presentFakeBG(screenW, screenH, camera.combined);
	
	stage.act(deltaTime);
	stage.draw();
	
	bgDrawer.presentOverlayBG(screenW, screenH,
							 (int)camera.position.x, (int)camera.position.y,
							 (int)camera.viewportWidth, (int)camera.viewportHeight,
							 stage.getSpriteBatch());
	
	if (splineBuilder != null) { splineBuilder.present(camera.combined); }
}
 
Example 9
Source File: Renderer.java    From VuforiaLibGDX with MIT License 5 votes vote down vote up
public void render(Display display, float delta) {
    GL20 gl = Gdx.gl;

    gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);

    TrackableResult[] results = null;

    if (vuforiaRenderer != null && vuforiaRenderer.isActive()) {
        //render camera background and find targets
        results = vuforiaRenderer.onDrawFrame();
    }

    gl.glEnable(GL20.GL_DEPTH_TEST);
    gl.glEnable(GL20.GL_CULL_FACE);


    double FOV = 1.0;
    if (vuforiaRenderer != null) {
        FOV = Math.toDegrees(vuforiaRenderer.getFieldOfViewRadians());
    }
    setProjectionAndCamera(display, results, (float) FOV);
    modelBatch.begin(camera);

    gl.glDepthMask(true);
    modelBatch.render(display.modelInstance, lights);

    modelBatch.end();

    gl.glDisable(GL20.GL_CULL_FACE);
    gl.glDisable(GL20.GL_DEPTH_TEST);
    gl.glDisable(GL20.GL_BLEND);
}
 
Example 10
Source File: SuperJumper.java    From ashley-superjumper with Apache License 2.0 5 votes vote down vote up
@Override
public void render() {
	GL20 gl = Gdx.gl;
	gl.glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
	gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
	
	super.render();
}
 
Example 11
Source File: Renderer.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
public void render (Simulation simulation, float delta) {
	// We explicitly require GL10, otherwise we could've used the GLCommon
	// interface via Gdx.gl
	GL20 gl = Gdx.gl;
	gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
	renderBackground();
	gl.glEnable(GL20.GL_DEPTH_TEST);
	gl.glEnable(GL20.GL_CULL_FACE);
	setProjectionAndCamera(simulation.ship);

	modelBatch.begin(camera);
	modelBatch.render(simulation.explosions);
	if (!simulation.ship.isExploding) modelBatch.render(simulation.ship, lights);
	modelBatch.render(simulation.invaders, lights);
	modelBatch.render(simulation.blocks);
	modelBatch.render(simulation.shots);
	modelBatch.end();

	gl.glDisable(GL20.GL_CULL_FACE);
	gl.glDisable(GL20.GL_DEPTH_TEST);

	spriteBatch.setProjectionMatrix(viewMatrix);
	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();
	font.draw(spriteBatch, status, 0, 320);
	spriteBatch.end();

	invaderAngle += delta * 90;
	if (invaderAngle > 360) invaderAngle -= 360;
}
 
Example 12
Source File: GdxApp.java    From libGDX-Path-Editor with Apache License 2.0 5 votes vote down vote up
@Override
public void render() {
	if (uiHandler != null) { uiHandler.updateMemoryInfo(getMemoryConsumption()); }
	
	if (screen != null) {
		screen.update(Gdx.graphics.getDeltaTime());
		screen.present(Gdx.graphics.getDeltaTime());
	}
	else {
		GL20 gl = Gdx.graphics.getGL20();
		gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
		gl.glClearColor(0.698f, 0.698f, 0.698f, 1f);
	}
}