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

Feedback shader

$
0
0

@pxt wrote:

hey there!
im trying to port this feedback shader https://www.shadertoy.com/view/ldsczf
from shadertoy to openframeworks. but it seems that i have a problem to get the current buffer and pass it to the shader as a texture uniform.

what im doing wrong?

fbo.begin();
    ofClear(0);
    cam.begin();
    ofClear(0,0,0,0);
    sphere.setPosition(0, 0, 0);
    sphere.draw();
    cam.end();
    fbo.end();
    
    glDisable(GL_DEPTH_TEST);
    
    fbo1.begin();
    ofClear(0,0,0);
    shader.begin();
     shader.setUniformTexture("feedback", fbo1.getTexture(), 1);
    shader.setUniform2f("resolution", fbo.getWidth(), fbo.getHeight());
    shader.setUniform1f("time", ofGetElapsedTimef());
    fbo.draw(0,0);
//        ofRect(0,0, 500, 500);
    shader.end();
    fbo1.end();
    

    ofSetRectMode(OF_RECTMODE_CORNER);
 
    
    fbo1.draw(0, 0, ofGetWidth(), ofGetHeight());

if i draw the fbo 0 into the fbo1 i get the texture using sampler2D tex0 in the shader. but i cant recive the feedback texture ( the same buffer) .

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles