Closed regnirpsj closed 10 years ago
Right now negative or relative indices are not supported. A model that works with the loader can be found here: http://sourceforge.net/projects/oglplus/files/assets/stanford_dragon.zip/download
I'll put this on the TODO list.
Support for negative indices was added in commit a5e71eafa998891aa234523dd223fa281933de8d on the develop branch. Please, let me know if it works with the model you used originally.
i tested the update but it seems like something else is going on. basically, i tested all of the models at http://graphics.cs.williams.edu/data/meshes.xml. most of them work now, thanks to supporting negative indices. however, the cube (http://graphics.cs.williams.edu/data/meshes/cube.zip) doesn't, bailing out with
'Obj file loader: Error reading indices: f -8/-4/-6 -7/-3/-6 -6/-2/-6'
i've opened the .obj file in several editors and checked the indices, but couldn't find any obvious problem. i had the suspicion that line endings might be a problem (e.g., "\r" only instead of "\n" or "\r\n") but that seems not to be the case.
OK, I'm going to have a look at that one.
Should be fixed now (since commit f8bc1a22e012b13f73f416a0e70d8d31d8a0ed1e on develop)
confirmed. however, i still have some older (as well as proprietary) .obj models lying around that don't work. now, i'm not going to badger you to do something about it. my question would rather be if it would make (more?) sense to rather develop a connection to some external loader framework (e.g., [http://assimp.sourceforge.net/] but also home-grown stuff) and how would i go about it?
Well, the OGLplus' OBJ loader is there mostly because I didn't want to have another external dependency for the examples and when I'm doing some quick prototyping. If you want to do anything serious then there are better loaders (and better formats) for scene geometry.
If you want to use some 3rd-party or your own loader, you just need to upload the vertex attribute data (and possibly indices) into appropriate buffers, create VAOs and and store some instructions for the GL drawing calls (like gl.DrawArrays, etc.) I don't know into how much detail should I go so right now I just say that there are some examples showing how to store external data in OGLplus Buffers, how to initialize the VAOs and how to use the draw calls. Also you can have a look at the shapes::ShapeWrapper
class to see how it uses Buffers, VAOs and the draw calls.
appreciated, i'll see that i can find the time to tinker with that (or find a student to actually figure it out :)
looks like as if
ObjMesh::_load_index
does not support negative indices in.obj
files. using the stanford dragon w/026_ssao
i get the following run-time error:what would be the easiest way to fix this?