stackgl / shader-school

:mortar_board: A workshopper for GLSL shaders and graphics programming
Other
4.28k stars 252 forks source link

problem with inputs in #18 - Lighting 2 #108

Closed fenomas closed 9 years ago

fenomas commented 9 years ago

For problem 18 (light 2 - diffuse lighting), the sample code given to the user declares:

attribute vec4 position, normal;

However, the "correct" implementation in the source code declares

attribute vec3 position, normal;

and than packs those vectors into vec4 values by appending 1.0 to position and 0.0 to normal.

Being entirely new to GLSL, I don't know which version is intended. I was able to get my code to pass by following the source and overwriting the w component of those two vectors, but I have no idea why that was necessary, and I don't see how anyone new to GLSL could pass this without checking the answers.