List of usage examples for com.badlogic.gdx.graphics Mesh render
public void render(ShaderProgram shader, int primitiveType, int offset, int count)
Renders the mesh using the given primitive type.
From source file:com.doom.render.QuadBatch.java
License:Apache License
@Override public void flush() { if (idx == 0) return;//w ww . j a v a 2s . c o m renderCalls++; totalRenderCalls++; int spritesInBatch = idx / 20; if (spritesInBatch > maxSpritesInBatch) maxSpritesInBatch = spritesInBatch; int count = spritesInBatch * 6; lastTexture.bind(); Mesh mesh = this.mesh; mesh.setVertices(vertices, 0, idx); mesh.getIndicesBuffer().position(0); mesh.getIndicesBuffer().limit(count); if (blendingDisabled) { Gdx.gl.glDisable(GL20.GL_BLEND); } else { Gdx.gl.glEnable(GL20.GL_BLEND); if (blendSrcFunc != -1) Gdx.gl.glBlendFunc(blendSrcFunc, blendDstFunc); } mesh.render(customShader != null ? customShader : shader, GL20.GL_TRIANGLES, 0, count); idx = 0; }
From source file:com.esotericsoftware.spine.utils.TwoColorPolygonBatch.java
License:Open Source License
@Override public void flush() { if (vertexIndex == 0) return;/*from w ww. ja va 2 s . c o m*/ totalRenderCalls++; lastTexture.bind(); Mesh mesh = this.mesh; mesh.setVertices(vertices, 0, vertexIndex); mesh.setIndices(triangles, 0, triangleIndex); Gdx.gl.glEnable(GL20.GL_BLEND); if (blendSrcFunc != -1) Gdx.gl.glBlendFuncSeparate(blendSrcFunc, blendDstFunc, blendSrcFuncAlpha, blendDstFuncAlpha); mesh.render(shader, GL20.GL_TRIANGLES, 0, triangleIndex); vertexIndex = 0; triangleIndex = 0; }
From source file:graphics.widgets.WidgetsPass.java
License:Open Source License
public void flush() { if (idx == 0 || lastTexture == null) return;/*from w ww. j a va 2s . c o m*/ int spritesInBatch = idx / 20; int count = spritesInBatch * 6; lastTexture.bind(0); Mesh mesh = this.mesh; mesh.setVertices(vertices, 0, idx); mesh.getIndicesBuffer().position(0); mesh.getIndicesBuffer().limit(count); if (blendingDisabled) { Gdx.gl.glDisable(GL20.GL_BLEND); } else { Gdx.gl.glEnable(GL20.GL_BLEND); if (blendSrcFunc != -1) Gdx.gl.glBlendFunc(blendSrcFunc, blendDstFunc); } mesh.render(shader, GL20.GL_TRIANGLES, 0, count); idx = 0; }