Your looks amazing, and all in 400 lines of code.
There is "only" one thing I really struggle with and it is the shader (as you can understand I am new to open gl).
How do I read it?
Code: Select all
vec4 position(mat4 transform_projection, vec4 vertex_position) {
modelView = view * model_matrix;
modelViewProjection = view * model_matrix * transform_projection;
normal = vec3(model_matrix_inverse * vec4(VertexNormal));
vposition = vec3(model_matrix * vertex_position);
return view * model_matrix * vertex_position;
}
2) "vposition" is not used. I removed it and still works.
3) "view * model_matrix" is computed twice and moreover for every call. would it be better it it were done once and for all in lua?
4) "normal" seems to be used to communicate with the other function. Are they called in sequence? for every pixel?
5) you seem to only use triangles. how do you create a square or more? many triangles? how do I assign a uniform texture to the square then?
Is this shader "standard" in 3D open gl? is it just a POC or is it a "good" shader?
Thank you again