WebGLSamples / WebGL2Samples

Short and easy to understand samples demonstrating WebGL 2 features
Other
1.01k stars 143 forks source link

Fix texture derivative perspective error, gl-matrix version, not used variable in glsl #84

Closed shrekshao closed 8 years ago

shrekshao commented 8 years ago
trungtle commented 8 years ago

Nice catch!

-Tr

On Feb 10, 2016, at 9:18 PM, Shuai Shao (Shrek) notifications@github.com wrote:

The perspective is wrong. lookAt in gl-Matrix generate a frustum matrix, not simply a view matrix. Fixed. The same problem remains in texture_vertex @trungtle Use gl-matrix-min.js of version 2.x instead of the 1.x version Delete a never used input in the vertex shader You can view, comment on, or merge this pull request online at:

https://github.com/WebGLSamples/WebGL2Samples/pull/84

Commit Summary

fix texture derivative perspective, gl-matrix version File Changes

M samples/texture_derivative.html (42) Patch Links:

https://github.com/WebGLSamples/WebGL2Samples/pull/84.patch https://github.com/WebGLSamples/WebGL2Samples/pull/84.diff — Reply to this email directly or view it on GitHub.

shrekshao commented 8 years ago

One more thing: since you use textureLod to select level of mipmap, I think you should gl.generateMipmap(gl.TEXTURE_2D); first? Right?, or there is only one level?

trungtle commented 8 years ago

This looks great for the fix. I removed the textureLevel function inside frag shader since I don't think there's a need for it anyway (not using mipmap)

pjcozzi commented 8 years ago

Thanks!