> // load texture as an image
> imgTexture = osgDB::readImageFile("model/BAKE_OVERRIDE.jpg");
> // if the image is successfully loaded
> if (imgTexture)
> {
> imgTexture->allocateImage(3500, 3500, 1, GL_RGBA,
> GL_UNSIGNED_BYTE);
Why are you reallocating space for an image loaded from file ?
Shouldn't the texture dimension be a power of 2 ?
> // create a new two-dimensional texture object
> texAvatar = new osg::Texture2D;
> // set the texture to the loaded image
> texAvatar->setImage(imgTexture);
> }
> node->getOrCreateStateSet()->setTextureAttributeAndModes(1, texAvatar,
> osg::StateAttribute::ON);
> node->getOrCreateStateSet()->addUniform(new osg::Uniform("editedMap",
> 1));
>
> // tell the camera to use OpenGL frame buffer objects
>
> //getCamera()->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
> getCamera()->attach(osg::Camera::COLOR_BUFFER1, imgTexture);
getCamera()->attach(osg::Camera::COLOR_BUFFER1, texAvatar );
Where is attachment for COLOR_BUFFER0 ?
You should read the framebuffer object spec :
http://www.opengl.org/registry/specs/ARB/framebuffer_object.txt
Especially the part that begins by "If the GL is bound to the default
framebuffer"...
attachement to osg::Camera::COLOR_BUFFER1 is only valid for a newly create
framebuffer, not the default one.
Regards,
-Fred
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org