I'm not sure what you mean by Property.  Is that OpenSGese?  We didn't
create any type of texture coordinate data structure.  All we want is
a pointer to the texture coordinate data structure already contained
in our geometry.  Our pointer to a 2-float data type (GeoTexCoordsPtr)
is wrong, and our pointer to a 3-float data type (GeoTexCoords3fPtr)
causes a crash.

However, we do create a secondary color data structure to copy the data into:

OSG::GeoColors3fPtr secondary_vert_colors = OSG::GeoColors3f::create();
      OSG::beginEditCP(secondary_vert_colors);
         for(int t=0;t<tex_coords->getSize();t++)
         {
            OSG::Vec3f temp = tex_coords->getValue(t);
            secondary_vert_colors->addValue(OSG::Color3f(
               temp[0] * 0.5f + 0.5f, temp[1] * 0.5f + 0.5f, temp[2] *
0.5f + 0.5f));
            //DEBUG_OUT(DLVL_STATUS) << "secondary " << t << ": " <<
secondary_vert_colors->getValue(t)
            //   << std::endl << DEBUG_FLUSH;
         }
      OSG::endEditCP(secondary_vert_colors);
      geom->setSecondaryColors(secondary_vert_colors);

-- 
Terry Welsh - mogumbo 'at' gmail.com
www.reallyslick.com  |  www.infiscape.com  |  www.vrsource.org


On 7/14/05, Dirk Reiners <[EMAIL PROTECTED]> wrote:
> 
>         Hi Terry,
> 
> On Thu, 2005-07-14 at 10:06 -0500, Terry Welsh wrote:
> > Trying to copy binormals so that we can put them into the secondary
> > color field, we do this:
> >
> > OSG::calcVertexTangents(geom);
> > OSG::GeoTexCoordsPtr& tex_coords = geom->getTexCoords2();  // get binormals
> > OSG::Vec3f temp = tex_coords->getValue(index);
> >
> > Unfortunately, this only copies the x and y components of the
> > binormals, but not the z component.
> 
> gaah! That was too obvious. :(
> 
> > If I print out
> > tex_coords->getValue(index) I only see 2 floats instead of 3.
> >
> > I tried this as well:
> > OSG::GeoTexCoords3fPtr& tex_coords =
> > OSG::GeoTexCoords3fPtr::dcast(geom->getTexCoords2());
> > But it crashes when I try to access it with tex_coords->getSize();
> >
> > Any suggestions?
> 
> How did you create the Property for the TexCoords? For 3D Texcoords you
> need to create a GeoTexCoords3fPtr and fill it using the Field
> interface:
> 
> GeoTexCoords3fPtr tc = GeoTexCoords3f::create();
> tc->getField()->push_back(Vec3f(x,y,z));
> 
> Hope it helps
> 
>         Dirk
> 
> 
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> Opensg-users mailing list
> Opensg-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/opensg-users
>


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to