Looking for some help with this. It's easy code to understand.
My makeshift push/pop matrix code seems to have no effect at all, the model doesn't translate to it's position.
1 2 3 4 5
| var savedMat = mat4.create(); savedMat.set(mvMatrix); mat4.translate(mvMatrix, [model.x, model.y, model.z]); gl.drawArrays(gl.TRIANGLES, 0, model.VertexPositionBuffer.numItems); mvMatrix.set(savedMat); |
I want the models to be drawn at their position/ and later on rotation, and not affect the mvMatrix (modelview matrix).
sudocode
1 2 3 4 5
| create temp matrix set temp matrix to modelview matrix translate modelview matrix to model position draw model set modelview matrix to temp matrix |