[osg-users] TextureRectangle, PBO difference between 1.2 and 2.0

2 views
Skip to first unread message

Christiansen, Brad

unread,
Aug 17, 2007, 4:55:17 AM8/17/07
to osg-...@lists.openscenegraph.org
Hi Robert,

As part of the task in moving our applications to OSG 2.0 I discovered
there is a change in the behaviour of the API when binding an image with
a PBO to a TextureRectangle.

Using 1.2 we could set the image on the texture and then simply call
setImage on the image object and the TextureRectangle would automaticaly
update. Since moving to 2.0 we have to call dirty on the Image after the
setImage call. This is not a big deal for me as it is an easy change to
make but I thought this might not have been an intentional change. I had
a quick look to see what this was the case but couldn't track it down.

This is what the code looks like:

//set things up
image = new Image();
image->setPixelBufferObject(new PixelBufferObject(image));
m_YTexture->setImage(image);

//the on update call...
Vimage->setImage(0.5 * m_imageWidth,0.5 * m_imageHeight,1,GL_LUMINANCE,
GL_LUMINANCE,
GL_UNSIGNED_BYTE,VBuffer,Image::AllocationMode::NO_DELETE);
//Since 2.0 we now also have to call the following for the texture to
update
Vimage->dirty();


As I said this is not an issue as such just thought you might have
wanted the behaviour to be consistent between versions.

Cheers,

Brad

DISCLAIMER:---------------------------------------------------------------------------
This Email may contain confidential and/or privileged information and is intended
solely for the addressee(s) named. If you have received this information in error, or
are advised that you have been posted this Email by accident, please notify the
sender by return Email, do not redistribute it, delete the Email and keep no copies.
--------------------------------------------------------------------------------------

_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Robert Osfield

unread,
Aug 17, 2007, 5:17:34 AM8/17/07
to osg-...@lists.openscenegraph.org
Hi Brad,

This is a bug, there shouldn't be a change in behavior w.r.t Texture
updating and PBO's. The mechanism behind is much changed but the
behavior should be the same.

I have looked at the code and found the that setImage and many other
others are doing a ++_modifiedCount rather than calling dirty(). This
will be bypassing the new mechanism that keeps the PBO in sync. I
have just gone through Image.cpp changing all the ++_modifiedCount
case to dirty(). The modified file is attached. The change are also
checked in to SVN.

I have tested the change on a movie file on my box and its working
fine, where a couple of days ago it wasn't working it was just loading
the first frame. I assumed it was a bug in the xine-lib plugin,
but... now know it wasn't, and now is fixed thanks to you uncovering
the right rock :-)

Could you test it out and let me know how you get on.

Robert.

Image.cpp
Reply all
Reply to author
Forward
0 new messages