Jump to content
Posted 19 October 2012 - 11:33 AM
Posted 19 October 2012 - 12:08 PM
Posted 19 October 2012 - 12:11 PM
I'd like to learn how to write a Mesh Parser, using features in OpenGL from 3.3 and up (my drivers should support 4.3, I'm currently running 4.2).
The question is, I'm not sure what techniques/concepts would be good to understand first. I know how to write a binary search tree, if that helps - but maybe a QuadTree or even an OcTree would be more useful?
Also what would be good to know is what kind of file formats are most common in the OpenGL world. Should I use blender to draw meshes, export the files, and render them in OpenGL? Is it possible and pragmatic to write a single mesh parser which would just render whatever kind of mesh I throw at it?
I'm aware of prewritten libraries such as GLMesh which help with this (though I'm not sure to what extent they do), but alas my goal is to learn so I'd like to avoid using something like that :3.
Posted 19 October 2012 - 03:31 PM
What sorts of meshes are you trying to parse? Terrain/large static structures should be handled differently from character models and small props. You probably need octree for the first but not for the others.
Start simple - write loader that generates single object/buffer. Once this works you may try octrees.
Edited by 7zSuperiorCompressionServ, 19 October 2012 - 03:32 PM.
Posted 20 October 2012 - 08:50 AM
Edited by greenzone, 20 October 2012 - 08:55 AM.
Posted 20 October 2012 - 08:21 PM
Edited by TheChubu, 20 October 2012 - 08:23 PM.
"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"
Posted 21 October 2012 - 12:48 PM
The file format will contain the vertex/geometry/fragment data, as well as, probably, which primitives (likely triangles, I'd imagine) to use as a basis for rendering the mesh. Once I have the mesh data structure taken care of in my C++ code, I could simply parse the file, store the vertex data in c-style structures or something like glm::vec4, and then pass those to my renderer in a loop - correct?
If that's the case, I assume that this wouldn't really take much math at all apart from a good understanding of the matrices, etc involved (unless, of course, I was using physics to do this, which will likely be a while from now).