3
사람이 다음과 같은 코드를 좀 도와 주시겠습니까 : 나는 직교 카메라로 큐브를 표시하려고하지만, 내가 볼 모두 검은 색 http://jsfiddle.net/bepa/2QXkp/WebGL을 직교 카메라
gl.viewport(0, 0, gl.viewportWidth, gl.viewportHeight);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
mat4.ortho(pMatrix, 0, gl.viewportWidth, 0, gl.viewportHeight, 0.1, 100);
mat4.identity(mvMatrix);
mat4.lookAt(mvMatrix, [0, 0, -40], [0, 0, 0], [0, 1, 0]);
전체 소스. 큐브는 (0, 0, 0), 카메라 (0, 0, -40)이어야하며 (0, 0, 0)을보아야합니다.
모든 행렬 변환에 대해 gl-matrix 2.2.0을 사용합니다.
편집 :이 제대로 작동
:
mat4.perspective(pMatrix, 45, gl.viewportWidth/gl.viewportHeight, 0.1, 100.0);
mat4.identity(mvMatrix);
mat4.lookAt(mvMatrix, [0, 40, -40], [0, 0, 0], [0, 1, 0]);
mat4.rotate(mvMatrix, mvMatrix, degToRad(45), [0, 1, 0]);
이 작동하지 않습니다 :
mat4.ortho(pMatrix, 0, gl.viewportWidth, 0, gl.viewportHeight, 0.1, 100);
mat4.identity(mvMatrix);
mat4.lookAt(mvMatrix, [0, 40, -40], [0, 0, 0], [0, 1, 0]);
mat4.rotate(mvMatrix, mvMatrix, degToRad(45), [0, 1, 0]);
대단히 감사합니다. 마침내 약간의 색상을 볼 수 있습니다 :) – coda
이 게시물을 참조하십시오 : http://stackoverflow.com/questions/11088678/webgl-isometric-projection –