Merge pull request #604 from Gustl22/issue_601
Playground renderer: bind with GLState, #601
This commit is contained in:
commit
1dba14ec9a
@ -101,7 +101,9 @@ public class GdxModelRenderer extends LayerRenderer {
|
|||||||
if (v.pos.zoomLevel < 16)
|
if (v.pos.zoomLevel < 16)
|
||||||
gl.clear(GL.DEPTH_BUFFER_BIT);
|
gl.clear(GL.DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
gl.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, 0);
|
// Unbind via GLState to ensure no buffer is replaced by accident
|
||||||
|
GLState.bindElementBuffer(GLState.UNBIND);
|
||||||
|
GLState.bindBuffer(GL.ARRAY_BUFFER, GLState.UNBIND);
|
||||||
|
|
||||||
// set state that is expected after modelBatch.end();
|
// set state that is expected after modelBatch.end();
|
||||||
// modelBatch keeps track of its own state
|
// modelBatch keeps track of its own state
|
||||||
@ -172,8 +174,8 @@ public class GdxModelRenderer extends LayerRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
gl.depthMask(false);
|
gl.depthMask(false);
|
||||||
gl.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, 0);
|
GLState.bindElementBuffer(GLState.UNBIND);
|
||||||
gl.bindBuffer(GL.ARRAY_BUFFER, 0);
|
GLState.bindBuffer(GL.ARRAY_BUFFER, GLState.UNBIND);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
// @Override
|
||||||
|
@ -102,7 +102,9 @@ public class GdxRenderer3D extends LayerRenderer {
|
|||||||
// if (position.zoomLevel < 17)
|
// if (position.zoomLevel < 17)
|
||||||
// GL.clear(GL20.DEPTH_BUFFER_BIT);
|
// GL.clear(GL20.DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
gl.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, 0);
|
// Unbind via GLState to ensure no buffer is replaced by accident
|
||||||
|
GLState.bindElementBuffer(GLState.UNBIND);
|
||||||
|
GLState.bindBuffer(GL.ARRAY_BUFFER, GLState.UNBIND);
|
||||||
|
|
||||||
// set state that is expected after modelBatch.end();
|
// set state that is expected after modelBatch.end();
|
||||||
// modelBatch keeps track of its own state
|
// modelBatch keeps track of its own state
|
||||||
@ -186,8 +188,8 @@ public class GdxRenderer3D extends LayerRenderer {
|
|||||||
log.debug(">>> " + (System.currentTimeMillis() - time) + " " + cnt + "/" + rnd);
|
log.debug(">>> " + (System.currentTimeMillis() - time) + " " + cnt + "/" + rnd);
|
||||||
|
|
||||||
gl.depthMask(false);
|
gl.depthMask(false);
|
||||||
gl.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, 0);
|
GLState.bindElementBuffer(GLState.UNBIND);
|
||||||
gl.bindBuffer(GL.ARRAY_BUFFER, 0);
|
GLState.bindBuffer(GL.ARRAY_BUFFER, GLState.UNBIND);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
// @Override
|
||||||
|
@ -104,7 +104,9 @@ public class GdxRenderer3D2 extends LayerRenderer {
|
|||||||
if (v.pos.zoomLevel < 17)
|
if (v.pos.zoomLevel < 17)
|
||||||
gl.clear(GL.DEPTH_BUFFER_BIT);
|
gl.clear(GL.DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
gl.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, 0);
|
// Unbind via GLState to ensure no buffer is replaced by accident
|
||||||
|
GLState.bindElementBuffer(GLState.UNBIND);
|
||||||
|
GLState.bindBuffer(GL.ARRAY_BUFFER, GLState.UNBIND);
|
||||||
|
|
||||||
// set state that is expected after modelBatch.end();
|
// set state that is expected after modelBatch.end();
|
||||||
// modelBatch keeps track of its own state
|
// modelBatch keeps track of its own state
|
||||||
@ -159,8 +161,8 @@ public class GdxRenderer3D2 extends LayerRenderer {
|
|||||||
// GLUtils.checkGlError("<" + TAG);
|
// GLUtils.checkGlError("<" + TAG);
|
||||||
|
|
||||||
gl.depthMask(false);
|
gl.depthMask(false);
|
||||||
gl.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, 0);
|
GLState.bindElementBuffer(GLState.UNBIND);
|
||||||
gl.bindBuffer(GL.ARRAY_BUFFER, 0);
|
GLState.bindBuffer(GL.ARRAY_BUFFER, GLState.UNBIND);
|
||||||
|
|
||||||
// GLState.bindTex2D(-1);
|
// GLState.bindTex2D(-1);
|
||||||
// GLState.useProgram(-1);
|
// GLState.useProgram(-1);
|
||||||
|
@ -97,7 +97,7 @@ public class CustomRenderer extends LayerRenderer {
|
|||||||
GLState.test(false, false);
|
GLState.test(false, false);
|
||||||
|
|
||||||
// unbind previously bound VBOs
|
// unbind previously bound VBOs
|
||||||
gl.bindBuffer(GL.ARRAY_BUFFER, 0);
|
GLState.bindBuffer(GL.ARRAY_BUFFER, GLState.UNBIND);
|
||||||
|
|
||||||
// Load the vertex data
|
// Load the vertex data
|
||||||
//mVertices.position(0);
|
//mVertices.position(0);
|
||||||
|
@ -29,6 +29,7 @@ public class GLState {
|
|||||||
static final Logger log = LoggerFactory.getLogger(GLState.class);
|
static final Logger log = LoggerFactory.getLogger(GLState.class);
|
||||||
|
|
||||||
public final static int DISABLED = -1;
|
public final static int DISABLED = -1;
|
||||||
|
public final static int UNBIND = 0;
|
||||||
|
|
||||||
private final static boolean[] vertexArray = {false, false};
|
private final static boolean[] vertexArray = {false, false};
|
||||||
private static boolean blend = false;
|
private static boolean blend = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user