I have a 'container' class A which inherit from Group, which has several
nodes, drawables etc. I also have a controller class B that calls some update
methods on A to update the geometry of some of A's member ( B has a pointer to
A objects.. is that 'allowed'?). I am wondering if im doing the update
correctly.. I render stuff but then suddenly everything dissapear.. Im pretty
sure it's not the osg, but If you could see if im doing the updates correct i
would appreciate it very much, since i didnt find any info on this.
The geometry in A is in a Vec3Array vertices, which is cleared and given new
data for each time updated. Afterwards i use "DrawArrays->set()" to sett
correct primitive set and size. At the end I call vertices->dirty().
Bwt. I do not explisitly need to call dirtyBound() do i?
I also have a class B same as A but which creates a billboard texture and so
on, and i am frequently updating the image data. I've set both the image and
texture's setDataVariance to DYNAMIC and in the to update the image i call:
_image->setImage(_width, _height, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE,
pixels, osg::Image::USE_NEW_DELETE);
And also, when i create a texture from a image, is the texture allways created
as a power-of-two texture? scaling the texcoords?
Thanks in advance!
Erlend
Example..
class A : osg::Group
{
osg::ref_ptr<osg::Geode> _geomNode;
osg::ref_ptr<osg::Geometry> _line;
osg::ref_ptr<osg::DrawArrays> _drawArrays;
osg::ref_ptr<osg::Vec3Array> _vertices;
A()
{
//instantiate and add nodes drawables..
}
updateSomething()
{
_vertices.clear();
while(something)
{
_vertices->push_back(osg::Vec3(data));
}
_drawArrays->set(osg::PrimitiveSet::TRIANGLE_STRIP, 0, _size);
_vertices.dirty();
}
}_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org