From: Carsten N. <car...@gm...> - 2006-12-29 14:04:50
|
Hi Frederik, Frederik Didden wrote: > Hi again, > > Do you mind putting us in the right direction concerning setting the > texture > coordinates? oh, sorry for not mentioning this (BTW for a better overview of these things there is a tutorial here: http://www.opensg.org/doc-1.6.0/TutorialIntroduction.html - the "Related Pages" link at the top leads to a chapter overview) The following is untested, but hopefully gets you started, otherwise please ask if something is unclear/not working. // your geometry GeometryPtr geo; // get the texture coordinates property, the // dcast will only succeed if you are actually using // Vec2f texture coordinates GeoTexCoords2fPtr texCoords = GeoTexCoords2fPtr::dcast(geo->getTexCoords()); if(texCoords == NullFC) { std::cerr << "error"; return; } // change texture coordinates (for a single quad) // will repeat the texture twice in s // direction once in t direction beginEditCP(texCoords, GeoTexCoords2f::GeoPropDataFieldMask); texCoords->setValue(Vec2f(0.0, 0.0), 0)); texCoords->setValue(Vec2f(2.0, 0.0), 1)); texCoords->setValue(Vec2f(2.0, 1.0), 2)); texCoords->setValue(Vec2f(0.0, 1.0), 3)); endEditCP(texCoords, GeoTexCoords2f::GeoPropDataFieldMask); Hope it helps, Carsten |