Question

I have a little Project setup using OpenGL and Core Video. I render to a FBO and use this as a Texture for other parts of the Programm, but it would be nicer to pass this Texture reference in form of a CVOpenGLTextureRef . But i cant find any Useful doumentation how to create this datatype from a Texture Name and Target (without copying any data).

Was it helpful?

Solution

As I understand it, to read data from an OpenGL context, you need to use a CVOpenGLBufferRef (which is a type of CVImageBufferRef). The documentation claims that these wrap pbuffers, but I would guess they work with FBOs. I haven’t tried it.

To render the data from a CVOpenGLBufferRef, you need to draw it to a texture using a CVOpenGLTextureCacheRef, which manages a set of CVOpenGLTextureRefs.

If you only want do draw the unmodified buffer contents, it’s probably more efficient to work within OpenGL. (Note that you can share textures/buffers between contexts using share groups, if necessary.)

If you do need to shuffle buffers around between contexts, and don’t want all that fluffy high-level abstraction and helpful documentation that you get with Core Video, you might want to look into IOSurface and CGLIOSurface.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top