Re: Standalone app, cook the world :)
Posted: 2008-09-11, 23:44
While I still didn't manage to try your code "live", I spotted an issue that is certainly a candidate for causing the crash that you experience: The counts of vertices and faces that you pass to the WorldDesc are not accurate.
In order to fix, why don't you remove the variables WORLD_NBVERTICES and WORLD_NBFACES entirely, then replacewith
This works because gWorldTriangles actually holds indices for triangles (not triangles themselves). To be more precise, it holds 3 indices for each triangle, thus the division by 3 yields the proper number of triangles.
Even if this doesn't immediately fix the crash, it makes your program shorter and more correct.
In order to fix, why don't you remove the variables WORLD_NBVERTICES and WORLD_NBFACES entirely, then replace
Code: Select all
WorldDesc.numVertices = WORLD_NBVERTICES; // Number of vertices in mesh.
WorldDesc.numTriangles = WORLD_NBFACES; // Number of triangles(3 indices per triangle)
Code: Select all
WorldDesc.numVertices = gWorldVertices.size(); // Number of vertices in mesh.
WorldDesc.numTriangles = gWorldTriangles.size()/3; // Number of triangles(3 indices per triangle)
Even if this doesn't immediately fix the crash, it makes your program shorter and more correct.