Hello,

 

currently I'm evaluating the geometry shader for silhouette
calculations. For that to work I do need to provide adjacency
information for my render primitives.

 

So I did the following:

-          full triangulation of my mesh

-          hashing of the adjancency information

-          use of GL_TRIANGLES_ADJACENCY_EXT and
GL_TRIANGLE_STRIP_ADJACENCY_EXT OpenGL types

 

Example: GL_TRIANGLES

 

        GeoUInt8PropertyUnrecPtr   _type;

        GeoUInt32PropertyUnrecPtr  _length;

        GeoPnt3fPropertyUnrecPtr   _vertices;

        GeoVec3fPropertyUnrecPtr   _normals;

        GeoVec2fPropertyUnrecPtr   _textures;

        GeoUInt32PropertyUnrecPtr  _indices;

        ...

        switch (mode) {

            case GL_TRIANGLES:

                {

                    assert(p.second.size() == 3);

 

                    int index[6];

 

                    index[0] = p.second[0];

                    index[2] = p.second[1];

                    index[4] = p.second[2];

 

                    PairT p10 = std::make_pair(p.second[1],
p.second[0]);

                    PairT p21 = std::make_pair(p.second[2],
p.second[1]);

                    PairT p02 = std::make_pair(p.second[0],
p.second[2]);

 

                    HashT::const_iterator iter;

                    

                    iter = adjancency_map.find(p10);

                    if (iter != adjancency_map.end())

                        index[1] = iter->second;

                    else

                        index[1] = index[0];    // degeneration!!!

 

                    iter = adjancency_map.find(p21);

                    if (iter != adjancency_map.end())

                        index[3] = iter->second;

                    else

                        index[3] = index[2];    // degeneration!!!

 

                    iter = adjancency_map.find(p02);

                    if (iter != adjancency_map.end())

                        index[5] = iter->second;

                    else

                        index[5] = index[4];    // degeneration!!!

 

                    _type->push_back(GL_TRIANGLES_ADJACENCY_EXT);

                    _length->push_back(6);

 

                    for (int i = 0; i < 6; ++i) {

                        _indices->push_back(index[i] + offset);

                    }

                }

                break;

            case GL_TRIANGLE_STRIP: ...

            case GL_TRIANGLE_FAN: ...

 

Ok, with this setup the geometry without any shader is still rendered
correctly.

 

My problem is now related to the TriangleIterator which I use for
intersection calculations. Am I correct that the iterator must have
knowledge about the new OpenGL primitives?

Are there any other OpenSG parts which are affected by these new OpenGL
primitives and there characteristics?

 

Out of curiosity, does anyone know, why there is no
"GL_TRIANGLE_FAN_ADJACENCY_EXT" primitive?

For now, I did split up my fan into separate triangles which is not that
nice.

 

Any help is appreciated.

 

Best,

Johannes

 

 

 


------------------------------------------------------------------------------
RSA&#174; Conference 2012
Save $700 by Nov 18
Register now&#33;
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to