Texture to fragment shader not working

So i´ve been trying to achive a simple Feedback effect. I know that for making a feedback effect with glsl you need the information of the previus frame pass a texture. The problem is that I can´t even pass a texture.

This is my code :

main.cpp

#include "ofMain.h"
#include "ofApp.h"
int main( ){
	setlocale(LC_CTYPE, "Spanish");
	ofGLFWWindowSettings settings;
	settings.setGLVersion(3, 2); //we define the OpenGL version we want to use
	ofSetupOpenGL(600, 600, OF_WINDOW);			// <-------- setup the GL context
	// this kicks off the running of my app
	// can be OF_WINDOW or OF_FULLSCREEN
	// pass in width and height too:
	ofRunApp(new ofApp());
  }

ofApp.h :

#pragma once
#include "ofMain.h"
class ofApp : public ofBaseApp{
public:
	void setup();
	void draw();
	ofImage img;
	    ofShader sh;
};

ofApp.cpp

#include "ofApp.h"
void ofApp::setup(){
	ofSetWindowShape(1024, 768);
	sh.load("","shaders/sh11.frag");
	img.load("lala.jpg");
}
void ofApp::draw() {
	sh.begin();
	sh.setUniformTexture("tex0", img.getTexture(), 0);
	sh.setUniform2f("resolution", ofGetWidth(), ofGetHeight());
	ofRect(0, 0, ofGetWidth(), ofGetHeight());
	sh.end();
	//img.draw(0, 0);
}

sh11.frag :

uniform sampler2DRect tex0;
uniform vec2 resolution;
//out vec4 outputColor;

void main()
{	
	vec2 uv = gl_FragCoord.xy / resolution;
    vec4 texture = texture2DRect(tex0, uv);
	//outputColor = vec4(uv.x,uv.y,0.0,1.0);
	
	gl_FragColor = texture;
	//gl_FragColor = vec4(uv.x,uv.y,0.0,1.0);
} 

I´ve tryed :

  • Defining versions : #version 150, #version 120, #version 130
  • settings.setGLVersion(2, 1); and settings.setGLVersion(3, 2); in main cpp.
  • using : img.getTexture() and img.getTextureReference() in the uniform.
  • setting the 3er parameter as 1 and 0 in .setUniformTexture (don´t know what this parameter does).
  • adding the first vertex shader from ofbook tutorial and tryed the exact same code from that tutorial.
  • using : gl_FragColor and outPutcolor.
  • sampler2DRect, and sampler2D with texture() , texture2D, texture2DRect()
  • Resized the image to be the same as my app resolution
    -All the above combinations that I could come up with.

Im not getting any compilation errors or anything in most of the cases, im just having a gray screen without anything on it. I don´t want to use vertex shader, only fragment shader for accoplish some background effects and that´s it. The image is a simple image that I use as an example, the image is loading fine.

The fragment shader in all cases works fines if i don´t use a texture, so the fragment shader is working, it does not receive any information from texture it seems

This is my pc specifications :

-AMD Ryzen 5 1600-sixCore Processor
-16,0GB RAM.
-NVIDIA GeForce GTX 1060GB

I´ve also tryed it in my notebook without not succes wich has this specs :

-Intel Core i7-55008 CPU @ 2.40ghz
-4.0GB RAM
-Intel HD Graphics 5500

I really have no clue what else I can try.

Finally got it working using this code in the fragment shader :

uniform sampler2DRect tex0;

void main()
{	
	vec4 texture =  texture2DRect(tex0, gl_FragCoord.xy);
	gl_FragColor = texture;
}