[osg-users] Building a Texture2D from a PBO?
trystan at trystan.org
Thu Apr 21 18:54:47 PDT 2011
I'm looking for a way to quickly read parts of images into parts of 2D textures. For instance, given a source rect for an image and a destination rect for the texture I want to get just the source rect into the dest rect with no scaling/resizing etc.
I thought I may be able to do something like the snippet below. However, this code crashes on copyTexSubImage. Am I on the right track at all here?
img = osgDB::readImageFile("image.png");
pbo = new osg::PixelBufferObject(img.get());
texture = new osg::Texture2D;
state = new osg::State;
texture->copyTexSubImage2D(*state, 0, 0, 0, 0, img->s(), img->t());
Thanks in advance,
Read this topic online here:
More information about the osg-users