I’m currently working in integrating Vuo in my application as an host , using the Cocoa API . Supporting compositions which conform to the VuoImageFilter protocol , I understood that I can pass a GL-TEXTURE to the dedicated image port using the - filterGLTexture:target:pixelsWide:pixelsHigh:atTime:outputPixelsWide:pixelsHigh: method . I’d like to support more that one image port . How , then could I pass a GL-TEXTURE to an image port type , without having to transform it to a NSImage . Is there a way though the Cocoa API , to link a GL-Texture to a VuoImage ?
Yes, you can pass a GL texture to an image port like this:
- Create a VuoImage wrapper for your GL texture (
VuoImage_make()
orVuoImage_makeClientOwned*()
). - Call
VuoImage_getInterprocessJson()
to put it on an IOSurface to enable transmission to the composition process. - Call
-[VuoRunnerCocoa setJSONValue:forInputPort:]
to assign it to a port.
What would be the GL_TEXTURE format expected while calling VuoImage_getInterprocessJson() ? If I’m creating a VuoImage wrapper with VuoImage_makeClientOwnedGlTextureRectangle() , and pass it to VuoImage_getInterprocessJson() , it sends an error : VuoImage.c:747 VuoImage_getColorDepth() Error: Unknown glInternalFormat 84f5 (GL_TEXTURE_RECTANGLE_ARB).
The format passed to VuoImage_makeClientOwnedGlTextureRectangle()
should be one of these:
GL_LUMINANCE8
GL_LUMINANCE8_ALPHA8
GL_RGB
GL_RGBA
GL_RGBA8
GL_BGRA
GL_LUMINANCE16F_ARB
GL_LUMINANCE_ALPHA16F_ARB
GL_DEPTH_COMPONENT
GL_RGB16
GL_RGBA16
GL_RGB16F_ARB
GL_RGBA16F_ARB
GL_TEXTURE_RECTANGLE_ARB
is a target, rather than a format, and is automatically set by VuoImage_makeClientOwnedGlTextureRectangle()
.