Hi All
So I'm using an extension on iOS that allows me to fast draw video frames
coming from the camera in OpenGL.
The requirement though is that I bind and create the texture during a callback
so I have to call makeCurrent on the osg context then do manual OpenGL
commands, like below.
Code:
_viewer->getCamera()->getGraphicsContext()->makeCurrent();
[self cleanUpTextures];
// CVOpenGLESTextureCacheCreateTextureFromImage will create GLES texture
// optimally from CVImageBufferRef.
glActiveTexture(GL_TEXTURE5);
err = CVOpenGLESTextureCacheCreateTextureFromImage(kCFAllocatorDefault,
_videoTextureCache,
pixelBuffer,
NULL,
GL_TEXTURE_2D,
GL_RGBA,
width,
height,
GL_BGRA,
GL_UNSIGNED_BYTE,
0,
&_lumaTexture);
if (err)
{
NSLog(@"Error at CVOpenGLESTextureCacheCreateTextureFromImage %d", err);
}
glBindTexture(CVOpenGLESTextureGetTarget(_lumaTexture),
CVOpenGLESTextureGetName(_lumaTexture));
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
I then use a uniform to tell osg where to look for the texture, in this case
channel 5 and everything works fine. The problems start when I introduce models
loaded and rendered with osg. All the models only use textures in channel 0,
but as soon as I start using them the video quad goes black and other textures
start flickering.
My guess is osg is is doing something to my texture, is there a way to tell osg
to leave a certain channel alone, or some other sort of magic?
Thanks
Tom
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=50157#50157
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org