the trick of cube culling?
tianzjyh opened this issue · 2 comments
tianzjyh commented
In the cube vertex shader, the code below flips the inside and outside faces of the cube. So when enable GL_CULL_FACE, we can see the inside faces instead of the outside faces.
position = gl_Vertex.xyz;\ position.y = ((1.0 - position.y) * (7.0 / 12.0) - 1.0) * poolHeight;\
But why does the top face of the cube disappear when I look up from the bottom of the cube ?
What's the trick here ? I just cannot find it.
evanw commented
I haven't looked at this code in a while, but I assume that was done by this line:
this.cubeMesh.triangles.splice(4, 2);
tianzjyh commented
OK, I got it! Thanks!
I rewrote the code in OpenGL, but was not able to explain the difference of the results.
Thanks for your answer.