I just figured out my problem that I was having. I had a small bug in my code that was preventing the Drawable from updating its image data. Using glBindTexture and then using osg::Image::readImageFromCurrentTexture worked out for me.
Thanks, Cody On Thu, Jul 18, 2013 at 7:19 PM, Cody Hanika <[email protected]> wrote: > Thanks for the response Robert. So what is going on is I am trying to > incorporate CEGUI into OpenSceneGraph. So CEGUI is a GUI system that is > meant to be used as a menu system that is always displayed 2d on the screen > and not embedded in 3d space. What I am trying to do is utilize CEGUI's > tools for quickly creating a functional GUI. The original example I found > was in the OSG 3 cookbook, and for my application I want to be able to > embed it in 3d space and have the user be able to interact with it. > > So what I have accomplished so far is used an osg::Drawable to give CEGUI > a context to render and then CEGUI provides a function to return its OpenGL > textureId which I then was able to just use glBindTexture with that and do > basic texture mapping to a quad using OpenGL calls. I was then able to > setup the GUI to dymically update as well as follow me through the scene. > But, I would now like to be able to actually use OpenSceneGraph's > osg::Geometry to draw this quad. To do this texture mapping, I am just > following the example in the OSG 3.0 beginner's guide, with the image > coming from the Drawable that is holding all the CEGUI stuff. > > So what I have is an OpenGL texture Id to work with, and I need use that > to map that texture to a quad. I know my texture mapping is correct as I > have just tried loading an image with osgDB and mapping that, and that > works. But when I am trying to grab the image from my drawable, what gets > mapped to the quad is the last texture that was used. I have tried using > Image::setImage as well as Image::readImageFromCurrentTexture after calling > glBindTexture, but neither have worked for me. > > tl;dr, given an OpenGL texture ID, how can I map the texture associated > with that ID to a quad using osg::Geometry? > > Thanks! > > Cody > > > On Thu, Jul 18, 2013 at 10:15 AM, Robert Osfield <[email protected] > > wrote: > >> Hi Cody, >> >> I'm a bit confused about what you might be trying to do. Could you take >> a step back and try to explain what you are trying to do at a higher level, >> then others should be better able to suggest how to tackle this type of >> task. >> >> Cheers, >> Robert. >> >> On 13 July 2013 22:10, Cody Hanika <[email protected]> wrote: >> >>> Hello everyone, >>> >>> I am trying to load an OpenGL texture into an osg::Image. I know the >>> OpenGL textureId and I have attempted using both >>> Image::readImageFromCurrentTexture after using glBindTexture() in a >>> Drawable subclass as well as manually using glGetTex* calls to retrieve >>> information about the texture from the texId and then using >>> Image::setImage. I am doing all of this in a Drawable subclass and then >>> returning the image to a class that draws a Geometry quad. I am calling >>> Image::dirty() and have the dataVariance as DYNAMIC. >>> >>> I am just getting the previosuly bound texture mapped to the quad. I >>> have just loaded a random texture using osgDB::readImageFile and that works >>> so I know I am mapping the texture correctly. >>> >>> Any idea if I am trying to set the osg::Image data incorrectly or if I >>> am missing something that I need to do? >>> >>> Thanks! >>> >>> Cody >>> >>> _______________________________________________ >>> 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 >> >> >
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

