Sunday, January 13, 2013

Small Progress

Good news is I got it to display! Bad news is it is still not quite right. I have no errors, but I have 274 warnings and only the water displays correctly.


Looks fun, right? It is pretty much something wrong with the vertexAttribPointer, so once that's fixed the other errors should clear up. Here is what gets displayed:


I spent all weekend trying to fix it. At least it's displaying now, that gives me a little hope :). I'm aiming to get it working in the next week or two.

On a side note, here is how I calculated the normals for the shading:

            v1 = vec3.create(((x[vals[1]-1])-(x[vals[3]-1])),
               ((y[vals[1]-1])-(z[vals[3]-1])),
               ((z[vals[1]-1])-(z[vals[3]-1])));
            v2 = vec3.create(((x[vals[2]-1])-(x[vals[3]-1])),
               ((y[vals[2]-1])-(z[vals[3]-1])),
               ((z[vals[2]-1])-(z[vals[3]-1])));

            v1 = vec3.normalize(v1);
            v2 = vec3.normalize(v2);

            vector = vec3.cross(v1, v2);

            rockVertexNormals.push(vector[0]);
            rockVertexNormals.push(vector[1]);
            rockVertexNormals.push(vector[2]);

-Vanessa

No comments:

Post a Comment