From af1cd5cc2bfefcf5eccfb54002b2e5c6a501d40c Mon Sep 17 00:00:00 2001 From: xiahaiqin Date: Sat, 4 Feb 2023 18:04:21 +0800 Subject: [PATCH] fix drawElements|drawElementsInstanced|drawRangeElements test Signed-off-by: xiahaiqin Change-Id: I35077498566603a64acc9086eeda713c479bcc38 --- graphic/webGL/src/main/js/default/test/WebGL.test01.js | 6 +----- graphic/webGL/src/main/js/default/test/WebGL.test02.js | 6 ++++++ graphic/webGL/src/main/js/default/test/WebGL.test05.js | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/graphic/webGL/src/main/js/default/test/WebGL.test01.js b/graphic/webGL/src/main/js/default/test/WebGL.test01.js index c789ca97e..7918fc12f 100644 --- a/graphic/webGL/src/main/js/default/test/WebGL.test01.js +++ b/graphic/webGL/src/main/js/default/test/WebGL.test01.js @@ -1998,11 +1998,7 @@ describe('webgl1Test_webgl2', function() { const indexBuffer = gl.createBuffer(); gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer); - gl.bufferData( - gl.ELEMENT_ARRAY_BUFFER, - indices, - gl.STATIC_DRAW - ); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices.buffer, gl.STATIC_DRAW); var maxViewPortDimsParameter = gl.getParameter(gl.MAX_VIEWPORT_DIMS); console.log('maxViewPortDimsParameter: ' + maxViewPortDimsParameter); diff --git a/graphic/webGL/src/main/js/default/test/WebGL.test02.js b/graphic/webGL/src/main/js/default/test/WebGL.test02.js index e7a133fa2..970ddbef6 100644 --- a/graphic/webGL/src/main/js/default/test/WebGL.test02.js +++ b/graphic/webGL/src/main/js/default/test/WebGL.test02.js @@ -2441,6 +2441,9 @@ describe('webgl1Test_webgl3', function() { it('webgl_test_drawElementsInstanced', 0, async function(done) { //initContext(); console.info("webgltest into drawElementsInstanced"); + const indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices.buffer, gl.STATIC_DRAW); const a = gl2.drawElementsInstanced(gl.POINTS, 2, gl.UNSIGNED_SHORT, 0, 4); @@ -2462,6 +2465,9 @@ describe('webgl1Test_webgl3', function() { it('webgl_test_drawRangeElements', 0, async function(done) { //initContext(); console.info("webgltest into drawRangeElements"); + const indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices.buffer, gl.STATIC_DRAW); const a = gl2.drawRangeElements(gl.POINTS, 0, 7, 8, gl.UNSIGNED_BYTE, 0); diff --git a/graphic/webGL/src/main/js/default/test/WebGL.test05.js b/graphic/webGL/src/main/js/default/test/WebGL.test05.js index af2608323..28db6a9f5 100644 --- a/graphic/webGL/src/main/js/default/test/WebGL.test05.js +++ b/graphic/webGL/src/main/js/default/test/WebGL.test05.js @@ -1241,7 +1241,7 @@ describe('webgl1Test_webgl6', function() { gl.uniform4iv(uniformlocationObj, int32list); const uniform4ivError = gl.getError(); console.info("testUniform4ivError: " + uniform4ivError); - expect(uniform4ivError).assertEqual(gl.INVALID_OPERATION); + expect(uniform4ivError).assertEqual(gl.NO_ERROR); done(); }) @@ -1331,7 +1331,7 @@ describe('webgl1Test_webgl6', function() { gl.uniformMatrix2fv(uniformlocationObj, true, flaot32list); const uniformMatrix2fvError = gl.getError(); console.info("uniformMatrix2fvError: " + uniformMatrix2fvError); - expect(uniformMatrix2fvError).assertEqual(gl.NO_ERROR); + expect(uniformMatrix2fvError).assertEqual(gl.INVALID_OPERATION); for(let err; (err = gl.getError()) != gl.NO_ERROR;) {} done(); }) -- GitLab