Hi Patrick, If the code is working in one app and not another then the the bit that is different is something beyond what code you've supplied so I can't see how we can help beyond general pointers.
In general I would say lots of users have done similar things to what you are doing and got on fine, either using TextureRectangle or Texture2D with non power of two textures. TextureRectangle is more widely supported across drivers and hardware so is often the better route to go. The only trick with TextureRectangle is that the texture coordinates are not the usual non dimensional 0..1 range, but 0 to the size of the texture. The osgmovie example should be a good reference for you. Robert. On Tue, Jun 2, 2009 at 4:21 PM, Patrick Pogscheba <[email protected]> wrote: > Hi, > > i have a code for loading a video-texture as background for AR-purposes. > > Basicly i grab the images from a webcam by DSVL and load them into an > imagestream. The imagestream is connected to a Texture2D on a quadGeometry. > This code wroked fine for me but now i've used it in a similar application > and I'm always getting a white/grey background (depending on lighting on/off). > > When i store the images from the texture in a filesequence, everything is OK, > so the stream is working. It must have st to to with the format , but i can't > get it. when i load the images from disk they are applied to the quad... > > Perhaps i've missed something in the new application, but as i can see it > everything is the same, > > so here is my code: > > > Code: > > // initialization > _imageStream = new osg::ImageStream(); > _imageStream->allocateImage(_videoSource->getWidth(),_videoSource->getHeight(),1,GL_BGRA,GL_UNSIGNED_BYTE,1); > _imageStream->setDataVariance(osg::Object::DYNAMIC); > > _texture = new osg::Texture2D(_imageStream.get()); > _texture->setDataVariance( osg::Object::DYNAMIC ); > _texture->setResizeNonPowerOfTwoHint(false); > _texture->setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR); > _texture->setFilter(osg::Texture::MAG_FILTER,osg::Texture::LINEAR); > _texture->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE); > _texture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); > > _geometry = osg::createTexturedQuadGeometry( > osg::Vec3f(0,0,0), > osg::Vec3f(_videoSource->getWidth()/2,0,0), > osg::Vec3f(0,_videoSource->getHeight()/2,0), > 0, > 0, > 1, > 1); > > _geode->addDrawable(_geometry); > _geode->getOrCreateStateSet()->setTextureAttributeAndModes > (0,_texture, osg::StateAttribute::ON); > > if (_imageStream) > _imageStream->play(); > > > // update-callback > _imageStream->setImage(_imageStream->s(), > _imageStream->t(), > 1, > GL_TEXTURE_2D, > GL_BGRA, > GL_UNSIGNED_BYTE, > _videoSource->getImage()->getData(), > osg::Image::NO_DELETE, > 1); > > > > > > > I'm desperate so i hope someone can give me the right hint on this issue. > I've tested with TextureRectangle but it wouldn't do it... > > Thank you! > > Cheers, > Patrick P. > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=13373#13373 > > > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

