Hi,
Ferdi Smit wrote:
Ok, thanks. I think that will work for now. There is an additional
problem that the location to write to changes each frame. I think I can
solve this by just binding a different image to the texture in the scene
graph (set to a different mem location) in an update callback, prior to
rendering, right?
I would even try just calling setImage again on the same osg::Image, it
doesn't allocate anything, just changes where it points to. I am not
sure that everything, e.g. binding, would update accordingly, but try.
Out of curiosity, how would I do it manually? I don't understand where I
can get the contextID unsigned int required for getting the
textureObject so I can bind it. Suppose I just have a simple program
with, I assume, a single context? It's also required in this call, if I
want to use the image but initiate the download manually:
readImageFromCurrentTexture
<a01404.html#155be606c3f5c8a0d4ce2160e2b25742> (unsigned int contextID,
...). This is useful if, for example, I want to stream multiple textures
to a mapped socket in a specific order, instead of letting OSG handle
when this happens exactly.
Sorry, I don't know. Search for where readImageFromCurrentTexture is called.
jp
J.P. Delport wrote:
Hi,
osg::Image can be created with already allocated memory.
snippet, modify as needed:
OSGImages_.push_back(new osg::Image());
OSGImages_[i]->setImage(ImageFormat_.getWidth(),
ImageFormat_.getHeight(),
1, 1, GL_LUMINANCE, GL_UNSIGNED_BYTE,
&(ImageBuffer_[i]->Data_[0]),
osg::Image::NO_DELETE);
&(ImageBuffer_[i]->Data_[0]) is memory in another class.
jp
Ferdi Smit wrote:
What would be the best way to download an osg texture into a region
of memory mapped host memory (i.e. at a fixed memory location)? I can
bind an osg::Image to a texture for the download, but as far as I
know I can not force an Image object to use a specific region of
memory; it does its own allocation on creation.
Do I have to do this manually using glGetTexImage()? I could get the
TextureObject associated with the texture, bind it, and then perform
the manual call. Only I'm not sure how I should set the contextID in
the osg::Texture::getTextureObject call. Or is there an easier way? I
really don't want to download it to an Image and then memcpy it to
the mapped region, since that's simply too slow.
--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard.
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.
This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean. MailScanner thanks Transtec Computers for their support.
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org