astellato / ofxSyphon

An OF add-on for using the Syphon framework.
Other
193 stars 57 forks source link

Problem on wrapping the texture to cvMat #37

Closed ghost closed 6 years ago

ghost commented 7 years ago

I am trying to wrap ofxSyphon texture to cvMat, that is my process:

    tex = client.getTexture();
    tex.readToPixels(pix);
    syphonMat = toCv(pix);

but there are the error while I run this line: tex.readToPixels(pix); [ error ] ofPixels: format doesn't support channels [ error ] ofGLUtils: ofGetGLFormatFromPixelFormat(): unknown OF pixel format-1, returning GL_LUMINANCE

Anyone have the ideas?

bangnoise commented 7 years ago

Have you read and observed the note about calling bind() and unbind() in the comments for getTexture()?

bangnoise commented 7 years ago

That said, once you get past that, readToPixels() is unlikely to work, due to how the underlying texture is created.

To get pixels from a Syphon texture you generally have to draw it into an FBO and then download from the FBO's backing.