Use of FBO and Shader causing positioning issues

Hello,
I noticed a positioning issue today when working with an FBO and Shader. I’m simply calling ofDrawCircle(ofGetMouseX(), ofGetMouseY(),radius) into and FBO then into a Shader. The X axis will be correct but the Y axis is reversed. However, when I std::cout << mouseX << mouseY I get the correct Y mouse information. So then I went on the check just drawing the FBO itself and found that the Y axis was correct! Now, I checked writing the shader over the FBO and noticed the Y axis reversal. My shader.vert is as follows:

#version 120

void main()
{
gl_Position = ftransform();
}

I’m not a shader expert so I’m curious am I doing something incorrectly to the positioning by calling fftransform?

Thanks for any help!

Hi there!

Can you show us how are allocating your FBO?

Also, are you using any camera?

In Setup()

   fbo.allocate(ofGetWidth(), ofGetHeight(), GL_RGBA);
    
    fbo.begin();
    ofClear(0);
    fbo.end();

In Draw()

  fbo.begin();
     ofClear(0);
    ofSetColor(ofColor::red);
    ofDrawCircle(ofGetMouseX(), ofGetMouseY(), 50);
    fbo.end();

    shader.begin();
    shader.setUniformTexture("iChannel0", fbo, 0);
    ofRect(0,0, ofGetWidth(), ofGetHeight());
    shader.end();

Ok so the fix I found was to call:

ofSetOrientation(OF_ORIENTATION_DEFAULT,false);

Referenced from another OF Forum entry