opengl es - Box polygon rendering w/ normals showing weird lighting/coloring -
opengl es - Box polygon rendering w/ normals showing weird lighting/coloring -
basically, have 2 triangles appear different in color (looks lighting issue due wrong normals). don't think case...
details
i have simple cube (box), each face composed of 6 vertices using vertex buffer (i not using index buffer @ moment).
in add-on vertices have defined normal values each face.
however, appears wrong either normals (which don't think there issue with) and/or lighting.
each face drawn using webgl.drawarrays using triangle_strip. image showing front end face of cube. next vertices (note origin top-left corner of front end face):
0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0
the next normals:
0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1
question
any ideas why 1st triangle lighter in color 2nd triangle?
the trick triangle strip each additional triangle gets 1 additional vertex 3 normal vectors. guess not specifying plenty normal vectors or specifying many vertices.
opengl-es webgl
Comments
Post a Comment