List of usage examples for com.badlogic.gdx.graphics GL20 GL_TRIANGLE_FAN
int GL_TRIANGLE_FAN
To view the source code for com.badlogic.gdx.graphics GL20 GL_TRIANGLE_FAN.
Click Source Link
From source file:com.bitfire.postprocessing.utils.FullscreenQuad.java
License:Apache License
/** Renders the quad with the specified shader program. */ public void render(ShaderProgram program) { quad.render(program, GL20.GL_TRIANGLE_FAN, 0, 4); }
From source file:com.box2dLight.box2dLight.LightMap.java
License:Apache License
public void render(Matrix4 combined, float x1, float x2, float y1, float y2) { boolean needed = rayHandler.lightRenderedLastFrame > 0; // this way lot less binding if (needed && rayHandler.blur) gaussianBlur();//from w ww .ja v a 2s . co m if (lightMapDrawingDisabled) { return; } frameBuffer.getColorBufferTexture().bind(0); // at last lights are rendered over scene if (rayHandler.shadows) { final Color c = rayHandler.ambientLight; ShaderProgram shader = shadowShader; if (RayHandler.isDiffuse) { shader = diffuseShader; shader.begin(); Gdx.gl20.glBlendFunc(GL20.GL_DST_COLOR, GL20.GL_SRC_COLOR); shader.setUniformf("ambient", c.r, c.g, c.b, c.a); } else { shader.begin(); Gdx.gl20.glBlendFunc(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA); shader.setUniformf("ambient", c.r * c.a, c.g * c.a, c.b * c.a, 1f - c.a); } lightMapMesh.render(shader, GL20.GL_TRIANGLE_FAN); shader.end(); } else if (needed) { Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE); withoutShadowShader.begin(); // withoutShadowShader.setUniformi("u_texture", 0); lightMapMesh.render(withoutShadowShader, GL20.GL_TRIANGLE_FAN); withoutShadowShader.end(); } Gdx.gl20.glDisable(GL20.GL_BLEND); }
From source file:com.box2dLight.box2dLight.LightMap.java
License:Apache License
public void gaussianBlur() { Gdx.gl20.glDisable(GL20.GL_BLEND);//from ww w. j a v a 2s . c o m for (int i = 0; i < rayHandler.blurNum; i++) { frameBuffer.getColorBufferTexture().bind(0); // horizontal pingPongBuffer.begin(); { blurShader.begin(); // blurShader.setUniformi("u_texture", 0); blurShader.setUniformf("dir", 1f, 0f); lightMapMesh.render(blurShader, GL20.GL_TRIANGLE_FAN, 0, 4); blurShader.end(); } pingPongBuffer.end(); pingPongBuffer.getColorBufferTexture().bind(0); // vertical frameBuffer.begin(); { blurShader.begin(); // blurShader.setUniformi("u_texture", 0); blurShader.setUniformf("dir", 0f, 1f); lightMapMesh.render(blurShader, GL20.GL_TRIANGLE_FAN, 0, 4); blurShader.end(); } frameBuffer.end(); } Gdx.gl20.glEnable(GL20.GL_BLEND); }
From source file:com.box2dLight.box2dLight.PositionalLight.java
License:Apache License
@Override void render() {//from w w w . ja v a2 s . c o m if (rayHandler.culling && culled) return; rayHandler.lightRenderedLastFrame++; lightMesh.render(rayHandler.lightShader, GL20.GL_TRIANGLE_FAN, 0, vertexNum); }
From source file:com.cyphercove.dayinspace.shared.FullScreenFader.java
License:Apache License
public void render(float deltaTime) { if (!on && alpha == 0) return; //nothing to draw or update alpha += (on ? 1 : -1) * deltaTime / fadeTime; alpha = Math.max(0, Math.min(1, alpha)); GL20 gl = Gdx.gl20;/*from w ww.j a v a 2 s .com*/ gl.glEnable(GL20.GL_BLEND); gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); color.a = Interpolation.fade.apply(alpha); shader.begin(); shader.setUniformf(u_color, color); mesh.render(shader, GL20.GL_TRIANGLE_FAN); shader.end(); }
From source file:com.cyphercove.lwptools.core.FullScreenFader.java
License:Apache License
public void render(float deltaTime) { if (elapsed >= fadeTime) return;// w ww .j a v a 2s .c om if (delay > 0) { delay -= deltaTime; } GL20 gl = Gdx.gl20; gl.glEnable(GL20.GL_BLEND); gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); color.a = delay > 0 ? 1f : 1f - Interpolation.fade.apply(elapsed / fadeTime); if (shader == null) createShader(); shader.begin(); shader.setUniformf(u_color, color); mesh.render(shader, GL20.GL_TRIANGLE_FAN); shader.end(); if (delay <= 0) elapsed += deltaTime; }
From source file:com.dgzt.core.shape.FilledCircleShape.java
License:Open Source License
/** * The constructor.//from www.ja v a 2 s . c om * * @param shader - The shader. * @param color - The color. */ public FilledCircleShape(final ShaderProgram shader, final Color color) { super(shader, GL20.GL_TRIANGLE_FAN, FilledCircleShape.VERTICES_NUM, getIndices(), color); }