OBJ Resource loader
To get the materials extracted from the obj-file, we first ran through the obj-file to find if the keyword "mtllib" was included in the file. If so, the sscanf-method was used to extract the lib name, and this was saved to a variable. The name of the file was concatenated with the path from the obj-file to give the complete path of the mlt-file. This was necessary because the helper method "LoadMaterialFile", in contradiction to the comments, required the complete path of the material file. As this was done, the materials was saved in the Material map.
RenderingView
To render the GeometryNode's constructed from the OBJ file we simply call the correct OpenGL functions. A GeometryNode consists of 3 vertices which all have color and texture coordinates. We just run through these between glBegin(GL_TRIANGLES) and glEnd() calls, that is we choose to minimize the number of glBegin/glEnd to one per GeometryNode.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment