List of usage examples for com.badlogic.gdx.graphics GL20 GL_CULL_FACE
int GL_CULL_FACE
To view the source code for com.badlogic.gdx.graphics GL20 GL_CULL_FACE.
Click Source Link
From source file:com.andgate.ikou.Ikou.java
License:Open Source License
@Override public void create() { Gdx.app.setLogLevel(Application.LOG_DEBUG); Gdx.input.setCatchBackKey(true);//from w w w . j av a 2s.c om Gdx.graphics.setVSync(true); screenAdjustments(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); Gdx.gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); Gdx.gl.glDisable(GL20.GL_CULL_FACE); skin = new Skin(Gdx.files.internal(Constants.SKIN_LOCATION)); loadShader(); loadFonts(); loadSounds(); setScreen(new MainMenuScreen(this)); }
From source file:com.badlogic.invaders.Renderer.java
License:Apache License
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;//from w w w . j ava 2 s . co m 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; }
From source file:com.bitfire.postprocessing.PostProcessor.java
License:Apache License
/** * Stops capturing the scene and apply the effect chain, if there is one. * If the specified output framebuffer is NULL, then the rendering will be * performed to screen.//from w w w. j a v a 2 s. co m */ public void render(FrameBuffer dest) { captureEnd(); if (!hasCaptured) { return; } // Array<PostProcessorEffect> items = manager.items; Array<PostProcessorEffect> items = enabledEffects; int count = items.size; if (count > 0) { Gdx.gl.glDisable(GL20.GL_CULL_FACE); // render effects chain, [0,n-1] if (count > 1) { for (int i = 0; i < count - 1; i++) { PostProcessorEffect e = items.get(i); composite.capture(); { e.render(composite.getSourceBuffer(), composite.getResultBuffer()); } } // complete composite.end(); } if (listener != null) { listener.beforeRenderToScreen(); } // render with null dest (to screen) items.get(count - 1).render(composite.getResultBuffer(), dest); // ensure default texture unit #0 is active Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0); } else { Gdx.app.log("PostProcessor", "No post-processor effects enabled, aborting render"); } }
From source file:com.blastedstudios.ledge.ui.postprocessing.PostProcessor.java
License:Apache License
/** Stops capturing the scene and apply the effect chain, if there is one. If the specified output framebuffer is NULL, then the * rendering will be performed to screen. */ public void render(FrameBuffer dest) { captureEnd();//www . ja va 2s. co m if (!hasCaptured) { return; } // Array<PostProcessorEffect> items = manager.items; Array<PostProcessorEffect> items = enabledEffects; int count = items.size; if (count > 0) { Gdx.gl.glDisable(GL20.GL_CULL_FACE); Gdx.gl.glDisable(GL20.GL_DEPTH_TEST); // render effects chain, [0,n-1] if (count > 1) { for (int i = 0; i < count - 1; i++) { PostProcessorEffect e = items.get(i); composite.capture(); { e.render(composite.getSourceBuffer(), composite.getResultBuffer()); } } // complete composite.end(); } if (listener != null && dest == null) { listener.beforeRenderToScreen(); } // render with null dest (to screen) items.get(count - 1).render(composite.getResultBuffer(), dest); // ensure default texture unit #0 is active Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0); } else { Log.log("PostProcessor", "No post-processor effects enabled, aborting render"); } }
From source file:com.lum.scram.postprocessing.PostProcessor.java
License:Apache License
/** Stops capturing the scene and apply the effect chain, if there is one. If the specified output framebuffer is NULL, then the * rendering will be performed to screen. */ public void render(FrameBuffer dest) { captureEnd();//from ww w . ja v a 2 s . c o m if (!hasCaptured) { return; } // Array<PostProcessorEffect> items = manager.items; Array<PostProcessorEffect> items = enabledEffects; int count = items.size; if (count > 0) { Gdx.gl.glDisable(GL20.GL_CULL_FACE); Gdx.gl.glDisable(GL20.GL_DEPTH_TEST); // render effects chain, [0,n-1] if (count > 1) { for (int i = 0; i < count - 1; i++) { PostProcessorEffect e = items.get(i); composite.capture(); { e.render(composite.getSourceBuffer(), composite.getResultBuffer()); } } // complete composite.end(); } if (listener != null && dest == null) { listener.beforeRenderToScreen(); } // render with null dest (to screen) items.get(count - 1).render(composite.getResultBuffer(), dest); // ensure default texture unit #0 is active Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0); } else { Gdx.app.log("PostProcessor", "No post-processor effects enabled, aborting render"); } }
From source file:com.lyeeedar.Roguelike3D.Graphics.Models.SkyBox.java
License:Open Source License
public void render(Camera cam) { Gdx.gl.glDisable(GL20.GL_DEPTH_TEST); Gdx.gl.glDepthMask(false);//from w w w. j av a 2 s . c o m Gdx.gl.glDisable(GL20.GL_CULL_FACE); Gdx.gl20.glActiveTexture(SKYBOX_TEXTURE_ACTIVE_UNIT); Gdx.gl20.glBindTexture(GL20.GL_TEXTURE_CUBE_MAP, textureId); shader.begin(); shader.setUniformMatrix("u_pv", cam.combined); shader.setUniformf("u_pos", cam.position); shader.setUniformi("u_texture", 0); mesh.render(shader, GL20.GL_TRIANGLE_STRIP); shader.end(); Gdx.gl.glEnable(GL20.GL_DEPTH_TEST); Gdx.gl.glDepthMask(true); Gdx.gl.glEnable(GL20.GL_CULL_FACE); }
From source file:com.lyeeedar.Roguelike3D.Graphics.Screens.AbstractScreen.java
License:Open Source License
@Override public void render(float delta) { update(delta);//from w w w . j a va 2s.c o m stage.act(delta); Gdx.graphics.getGL20().glClearColor(0.0f, 0.0f, 0.0f, 0.0f); Gdx.graphics.getGL20().glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT); Gdx.graphics.getGL20().glEnable(GL20.GL_CULL_FACE); Gdx.graphics.getGL20().glCullFace(GL20.GL_BACK); Gdx.graphics.getGL20().glEnable(GL20.GL_DEPTH_TEST); Gdx.graphics.getGL20().glDepthMask(true); drawModels(delta); Gdx.graphics.getGL20().glDisable(GL20.GL_CULL_FACE); drawTransparent(delta); Gdx.graphics.getGL20().glDisable(GL20.GL_DEPTH_TEST); drawOrthogonals(delta); fps.log(); }
From source file:com.perfectplay.org.SkyBox.java
License:Open Source License
public void render(PerspectiveCamera camera) { invView.set(camera.view);//from w w w .j av a 2s . c om // Remove translation invView.val[Matrix4.M03] = 0; invView.val[Matrix4.M13] = 0; invView.val[Matrix4.M23] = 0; invView.inv().tra(); mvp.set(camera.projection); mvp.mul(invView); Gdx.gl.glEnable(GL20.GL_CULL_FACE); Gdx.gl.glCullFace(GL20.GL_FRONT); Gdx.gl.glFrontFace(GL20.GL_CCW); Gdx.gl20.glDisable(GL20.GL_BLEND); Gdx.gl20.glDisable(GL20.GL_DEPTH_TEST); Gdx.gl20.glDepthMask(false); Gdx.gl20.glActiveTexture(GL20.GL_TEXTURE0); Gdx.gl20.glBindTexture(GL20.GL_TEXTURE_CUBE_MAP, g_cubeTexture); program.begin(); program.setUniformMatrix("u_mvpMatrix", mvp); program.setUniformi("s_cubemap", 0); cube.render(program, GL20.GL_TRIANGLE_STRIP); program.end(); Gdx.gl.glEnable(GL20.GL_DEPTH_TEST); Gdx.gl.glDepthMask(true); }
From source file:org.ah.gcode.preview.GCodePreview.java
License:Open Source License
@Override public void render() { if (loadingAssets && assetManager.update()) { finishedLoading();//from w w w .java 2 s. co m } if (loadingAssets) { } else { if (parsingGCode) { parseGCode(); } else if (preparingMeshes) { prepareMesh(); } else { } } camera.update(); Vector3 lightDirection = new Vector3(camera.direction).nor(); directionalLight.set(lightColor, lightDirection); // Magic rendering initialisation Gdx.gl.glDisable(GL20.GL_CULL_FACE); Gdx.gl.glDisable(GL20.GL_DEPTH_TEST); // Gdx.gl.glEnable(GL20.GL_BLEND); // Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); Gdx.gl.glClearColor(1f, 1f, 1f, 1f); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT | (Gdx.graphics.getBufferFormat().coverageSampling ? GL20.GL_COVERAGE_BUFFER_BIT_NV : 0)); Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); if (instances.size() > 0) { modelBatch.begin(camera); for (ModelInstance instance : instances) { modelBatch.render(instance, environment); } // gCodeModel.render(modelBatch, environment); modelBatch.end(); } if (controller != null) { controller.render(camera, environment); } spriteBatch.begin(); spriteBatch.setProjectionMatrix(spriteFontCamera.combined); spriteBatch.enableBlending(); window.render(spriteBatch); spriteBatch.end(); }
From source file:postprocessing.PostProcessor.java
License:Apache License
/** Stops capturing the scene and apply the effect chain, if there is one. If the specified output framebuffer is NULL, then the * rendering will be performed to screen. */ public void render(FrameBuffer dest) { captureEnd();//from w ww . java 2s. co m if (!hasCaptured) { return; } // Array<PostProcessorEffect> items = manager.items; Array<PostProcessorEffect> items = enabledEffects; int count = items.size; if (count > 0) { Gdx.gl.glDisable(GL20.GL_CULL_FACE); Gdx.gl.glDisable(GL20.GL_DEPTH_TEST); // render effects chain, [0,n-1] if (count > 1) { for (int i = 0; i < count - 1; i++) { PostProcessorEffect e = items.get(i); composite.capture(); { e.render(composite.getSourceBuffer(), composite.getResultBuffer()); } } // complete composite.end(); } if (listener != null && dest == null) { listener.beforeRenderToScreen(); } // render with null dest (to screen) items.get(count - 1).render(composite.getResultBuffer(), dest); // ensure default texture unit #0 is active Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0); } else { Gdx.app.log("PostProcessor", "No post-processor effects enabled, aborting render"); } }