Butler, Lee Mr CIV USA USAMC wrote:
Paul,

My CAD data comes to me as a triangle "soup" without surface normals.
Right now it comes to me as wavefront OBJ format.
Item 1: I would rather not display any "smoothing".  That looks like it
will take mods to the obj plugin to avoid the smoothing (unless someone
can point me at something else).

Item 2: The majority of normals point along one of the 6 major axis
directions (or a small number of other directions).  I could easily
quantize to byte (not float) normals and be quite happy.  But I think
that gets me writing shaders, which I was hoping to avoid.

I had thought there was a way to tell OpenGL to use an index indirection
table for elements.  My thought was I could load a small array of
normals, an array of vertexes, and an array of indexes which maps the
vertex index to the normal index.  Alas, I don't seem to be able to
figure out the nuance of this in OSG (or OpenGL) at the moment.

There are separate index arrays for each vertex attribute (setVertexIndices(), setNormalIndices(), etc), but there are two problems with this:

First, as you've noticed, the OBJ loader plugin won't do this for you, so at the very least you'd have to modify it. (This should be really easy to do because of the way the OBJ format is laid out).

Second, using the index lists will force you to use OpenGL immediate mode (glBegin, glEnd), which is terribly slow. This interface has even been removed from OpenGL 3. If you really have so much data to display that you're having trouble fitting it in memory, I doubt you'll get so much as 0.1 frames per second using immediate mode. Maybe this isn't a problem for your particular application, I don't know. Most of OSG takes great pains to avoid immediate mode, but it's there if you need it.

Hope this helps...

--"J"

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to