How to use texture feedback in a shader?

I have been converting a few shaders I’ve built in Jitter and have come to this issue a couple times. Two questions:

How do I handle multiple texture coordinates in oF? I understand how to pass in the textures:

    lumaDrag.setUniformTexture("tex0", compFbo.getTexture(), 0);
    lumaDrag.setUniformTexture("tex1", compFbo.getTexture(), 1);

but I don’t know how to access the coordinates of the two independently (texcoord0 and texcoord1). I just don’t know what I have to put in my vert shader to do this.

Finally, how can I take the result from the shader and immediately send it back in as my second texture? In Jitter I would pass the result into a slab, and immediately into the second input of the shader object.

Any help is appreciated!

EDIT: Okay, so I appear to have my first question solved, or at least I hope so. My vert shader now looks like this:

#version 150

uniform mat4 projectionMatrix;
uniform mat4 modelViewMatrix;
uniform mat4 modelViewProjectionMatrix;

in vec4  position[2];
in vec2  texcoord[2];

out vec2 texcoord0, texcoord1;

void main(){
    texcoord0 = texcoord[0];
    texcoord1 = texcoord[1];
    gl_Position = modelViewProjectionMatrix * position[0];

I’m not throwing errors at least…

The feedback doesn’t seem to be working. I created a second fbo for the feedback, but it appears something is out of order. Below is my ofApp.cpp:

for the 2nd texture coordinates, you usually don’t need them cause you can just use the same ones if you are using normalized coordinates or at most do a simple calculation in the vertex shader to derive them from there, like invert them or something like that.

from your code it seems all you are drawing is a couple of videos so i don’t think you need extra texture coordinates. just enable normalized texcoords by calling:


in setup before allocating anything and use the same texcoord for both textures.

to draw onto a third texture just begin an fbo draw as you would normally do, end the fbo and use fbo.getTexture to get the texture with the result.

not sure what you are trying to do but in your example there seems too many fbos, you don’t need one fbo for every video, image… just use getTexture directly on the video, images… to access their texture.

Is there a way to use pass a texture and use it in the fragment? without using vertex shaders?