opengl gml per face normal and per face vertex question
I am trying to make it in my program so that I display what it looks like with per face normals without per vertex normals and vice versa. I am not calculating these attributes manually, I am using the GML class by Nate Robbins and his glmFacetNormals(.obj, degrees) and glmVertexNormals(.obj) for the .obj files I am using. Whenever I take away glmFacetNormals() for a particular .obj file, I get a run time error that kills the program it says asstertion fails: facet norms so I am unable to display what it would look like with just per vertx normals. Does anyone know how to fix this? I appreciate your help, thanks
Re: opengl gml per face normal and per face vertex question
Maybe try vertex normals. There may only be one present.
If you're using a buggy or undocumented lib it may be time to roll your own or use something like collada.
Drawing an object with normals is simple, just draw a line from tehe vertex coordinate to the vertex coordinate+normal position. If you're drawing the object then I assume you are using the normals, so if this is in someone elses code then I suggest you take a look at their drawing code, if you do the drawing then you already have the verts & normals. Either way you really should be able to grab this if you're coding in a meaningful way near the OpenGL level.
For facet normals calculation just take the normalized cross product of two edges on the triangle (winding is important it will determine direction - inside or outside).