I found an issue when I try to use the gl.DEPTH_BUFFER_BIT .
I found the issue on the Android device.
Example code
draw() {
// Tell WebGL how to convert from clip space to pixels
gl.viewport(0, 0, (width * flgl.dpr).toInt(), (height * flgl.dpr).toInt());
// Clear the canvas. sets the canvas background color.
gl.clearColor(0, 0, 0, 1);
// Clear the canvas.
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
// Turn on culling. By default backfacing triangles will be culled.
gl.enable(gl.CULL_FACE);
// Enable the depth buffer
gl.enable(gl.DEPTH_TEST);
// print('CULL_FACE Enabled: ${gl.getParameter(gl.CULL_FACE)}');
// print('DEPTH_TEST Enabled: ${gl.getParameter(gl.DEPTH_TEST)}');
// Tell it to use our program (pair of shaders)
gl.useProgram(program);
// Turn on the attribute
gl.enableVertexAttribArray(positionLocation);
// Bind the position buffer.
gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer);
// Tell the attribute how to get data out of positionBuffer (ARRAY_BUFFER)
var size = 3; // 3 components per iteration
var type = gl.FLOAT; // the data is 32bit floats
var normalize = false; // don't normalize the data
var stride = 0;
var offset = 0; // start at the beginning of the buffer
gl.vertexAttribPointer(positionLocation, size, type, normalize, stride, offset);
}
And I get this:
But I want this:
I found a workaround that fixes this issue but I am not sure if this produces any other issues
I found an issue when I try to use the
gl.DEPTH_BUFFER_BIT
.I found the issue on the Android device.
Example code
And I get this:
But I want this:
I found a workaround that fixes this issue but I am not sure if this produces any other issues