Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Send video texture to shader?

$
0
0

@ttyy wrote:

I've done this before, but in previous version of oF (0.8.4 and 0.9.0).

Basically, I have a fragment shader that inverts the colors of a texture.

I want to run this on a video (ofVideoPlayer loading 640x480 h264 .mp4)

here's my code:
in setup

shader.load("","shader.frag");

in draw

if (bInvert){
        shader.begin();
        shader.setUniform2f("u_resolution",_w,_h);
        shader.setUniformTexture("u_tex0",bgVid->getTexture(),0);
        ofDrawRectangle(0,0,_w,_h); // draw shader
        shader.end();
}

But I get the error:

[ error ] ofTexture: getTextureData(): texture has not been allocated

I've also tried setting the uniform texture number to 1, same issue

any thoughts?

Posts: 3

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles