Hi again,

I've reduced the triangles to 2 for each of the 6 geometries to test it, and still had the same results. It takes 37 to 38 seconds to 'pre-render' (or validate) 18 of my objects composed of 6 geometry nodes (doesn't matter how many triangles, although I didn't try with a large amount of them). But I made a mistake, the frozen time spent is the same either with my geometry or any other, sorry. I guess either the error is somewhere else, or it really should take this long.
  And yes the missing for loop is cut and paste error.

   Thanks again,

         Sérgio Vieira

Andreas Zieringer wrote:

Hi Sérgio,

the first time your node is rendered OpenSG internaly creates a display list this takes some time. How many triangles do your geometry have? Can you try to call window->validateAllGLObjects() once before rendering. The missing for loop to create the texture coordinates is just a cut and paste error?

Andreas

Hi,

I'm working on an application which uses custom-made geometry. The problem is that the first time the application renders a node which it hasn't rendered before it freezes for a while (a long while) and then works fine. This happens with my geometry but not with functions in OSGSimpleGeometry like makeSphereGeo. I noticed that the problem is not due to the amount of vertices and faces (different number of vertices and faces, same problem, same freezing time), although the more objects, the more freezing time I'll get.

Here's my code (sorry about the size of it, I've cut it the most I could):

<code>

   GeoPositions3fPtr pPos;
   GeoTexCoords2fPtr pCoords;
   GeoPTypesUI8Ptr pType;
   GeoPLengthsUI32Ptr pLength;
   GeoIndicesUI32Ptr pIndices;
   GeoPositions3f::StoredFieldType  * pP;
   GeoTexCoords2f::StoredFieldType  * pTx;
   GeoIndicesUI32::StoredFieldType    * pI;
   GeoPLengthsUI32::StoredFieldType   * pL;
   GeoPTypesUI8::StoredFieldType      * pT;

   for( n = 0; n < 6; n++ )
   {
       pPos = GeoPositions3f::create();
       pCoords = GeoTexCoords2f::create();
       pType = GeoPTypesUI8::create();
       pLength = GeoPLengthsUI32::create();
       pIndices = GeoIndicesUI32::create();

       pP = pPos->getFieldPtr();

       // position & colors
       beginEditCP(pPos);
       for(i=0; i<m_iNumPoints; i++)
       {
           ...........calculate vTemp.........
           pP->push_back( vTemp );
       }
       endEditCP(pPos);

       pTx = pCoords->getFieldPtr();
       // tex coords
beginEditCP(pCoords); pTx->push_back(Vec2f(...)); endEditCP(pCoords);

       pT = pType->getFieldPtr();
       // type of primitives
       beginEditCP(pType);
           pT->push_back(GL_TRIANGLES);
       endEditCP(pType);

       pL = pLength->getFieldPtr();
       // vertex count
       beginEditCP(pLength);
           pL->push_back(iNumTris*3);
       endEditCP(pLength);

       pI = pIndices->getFieldPtr();
       // indices
       beginEditCP(pIndices);
           for(i=0; i<iNumTris; i++)
           {
                pI->push_back(...);
                pI->push_back(...);
                pI->push_back(...);
           }
       endEditCP(pIndices);

       m_pGeo[n] = Geometry::create();
       beginEditCP(m_pGeo[n]);
           m_pGeo[n]->setIndices(pIndices);
           m_pGeo[n]->setTypes(pType);
           m_pGeo[n]->setLengths(pLength);
           m_pGeo[n]->setPositions(pPos);
           m_pGeo[n]->setTexCoords(pCoords);
           m_pGeo[n]->setMaterial(getDefaultMaterial());
m_pGeo[n]->getIndexMapping().push_back( Geometry::MapPosition | Geometry::MapTexCoords ); // <- saw this in makePlaneGeo
       endEditCP(m_pGeo[n]);

       calcVertexNormals( m_pGeo[n] );

       m_pGeoNode[n] = Node::create();
       beginEditCP( m_pGeoNode[n] );
           m_pGeoNode[n]->setCore(m_pGeo[n]);
//m_pGeoNode[n]->setCore(makeSphereGeo(3,1)); // <- by removing the line above and using this one, it works without the freeze
       endEditCP( m_pGeoNode[n] );
   }

   m_pNode = Node::create();
   beginEditCP(m_pNode);
       m_pNode->setCore(Group::create());
       for( n = 0; n < 6; n++ )
       {
           m_pNode->addChild(m_pGeoNode[n]);
       }
   endEditCP(m_pNode);

</code>

The object is composed of 6 different geometric parts as you can see.
I think the problem is in the geometry creation, because replacing my geometry with simple geometry functions (as I comented on the code) it stays frozen for a shorter period of time. I've looked in the OpenSG source for make[...]Geo functions and still can't find out what's the problem. I either force it to render all nodes in the first frame and get a reasonable amount of frozen time, or it freezes everytime a node is rendered for the first time. After that, all is normal.

Thanks in advance,

      Sérgio Vieira




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users





-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to