Hi Enrico,
to get the colors
GeometryPtr geo = ...
GeoColorsPtr colors = geo->getColors();
For the other poperties
GeoColorsPtr colors2 = geo->getSecondaryColors();
GeoTexCoordsPtr texcoord0 = geo->getTexCoords();
GeoTexCoordsPtr texcoord1 = geo->getTexCoords1();
....
To set them
if(colors == NullFC)
{
// Geometry has no vertex colors so we create some.
colors = GeoColors3f::create();
beginEditCP(geo);
geo->setColors(colors);
endEditCP(geo);
colors->resize(geo->getPositions()->getSize());
}
beginEditCP(colors);
for(UInt32 i=0;i<geo->getPositions()->getSize();++i)
{
// set the color for each vertex.
colors->setValue(Color3f(0.0, 0.0, 1.0), i);
}
endEditCP(colors);
if(geo->getIndexMapping().size() > 0)
{
beginEditCP(geo);
Int16 pi = geo->calcMappingIndex(Geometry::MapPosition);
geo->getIndexMapping()[pi] |= Geometry::MapColor;
endEditCP(geo);
}
hiya,
I am expanding my app,
now after some playing with reflections and refractions,
i'd like to add shades and colors,
but for so doing, i need to get the color values of the vertices,
and the "illumination" level.
How do i pass the color to the shader? I think in the shader will be
something like
vec4 outColor = gl_Color;
but in OpenSG? A simple ->setColors(red) would do the trick?
Regarding the illumination level, it should be a simple float, ranging
[0,1], telling me how much light is hitting the point... where to store
that value per vertex? is there an unused slot that i can use to my
convenience? Something like a second texcoord set to use as a mere pipe
between OSG and the shader. So my shader should retrive the value like:
float lightlevel = gl_TexCoord[1].x;
hope someone can help,
enrico
--
Andreas Zieringer [EMAIL PROTECTED]
Fraunhofer IGD - A4 phone +49 (0)6151 155 289
Fraunhoferstr. 5 fax +49 (0)6151 155 196
D-64283 Darmstadt www.igd.fhg.de/www/igd-a4
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users