Texture loses resolution when applied to a plane primitive

Hello, I have a strange issue applying a texture to an ofPlanePrimitive.

If I draw the texture on the screen, I see this:
good

When I apply the texture to an ofPlanePrimitive, the resolution of the texture get suddenly way lower:
bad

The texture and the plane have the same dimensions.

This is the code in which I apply the texture to the plane


// variables in the header
ofShader myShader;
ofImage test;
ofPlanePrimitive plane;


// in setup method
test.load("test.jpg");
plane.set(test.getWidth(), test.getHeight(), 2, 2);
plane.mapTexCoordsFromTexture(test.getTexture());

// in draw method

        myShader.setUniformTexture("tex0",test.getTexture(), 0);
        myShader.begin();
        ofPushMatrix();

        ofTranslate(test.getWidth()/2, test.getHeight()/2);
        ofRotateXDeg(180);
        plane.draw();
        ofPopMatrix();
        myShader.end();

This is my vertex shader

#version 150

uniform mat4 modelViewProjectionMatrix;

in vec4 position;
in vec2 texcoord;
out vec2 texCoordVarying;

void main(){
    texCoordVarying = texcoord;
    gl_Position = modelViewProjectionMatrix * position;
}

and this is the fragment one

#version 150

out vec4 outputColor;
in vec2 texCoordVarying;
uniform sampler2DRect tex0;

void main(){
    vec4 texel0 = texture(tex0, texCoordVarying);
    outputColor = texel0;
}

As you see, I am using ARB texture coordinates. If I disable them, a lot of other things that I have in this application stop to work. That’s why I would like to find a solution using ARB coordinates.

If I change the mig mag filter option, like this

auto tex = img.getTexture();
tex.generateMipMaps();
tex.setTextureMinMagFilter(GL_NEAREST, GL_NEAREST);
myShader.setUniformTexture("tex0",tex, 0);

I obtain another result.

mig-mag

Far from what I want, but maybe tuning the mig mag filter is the key. (via a really old answer by @zach unfiltered texture )

Well, this warning is telling me that I should not use ARB textures in this case:

[warning] Mipmaps are not supported for textureTarget 0x84f5
Most probably you are trying to create mipmaps from a GL_TEXTURE_RECTANGLE texture.
Try ofDisableArbTex() before loading this texture.

Ok, the following snippet solves the problem on a mac retina. It is still not working on Ubuntu and on a monitor with a bad resolution. I will test later with Ubuntu and a better monitor, just to be sure that the problem is the monitor and not Ubuntu

auto tex = img.getTexture();
tex.setTextureMinMagFilter(GL_NEAREST, GL_NEAREST);
myShader.setUniformTexture("tex0",tex, 0);

I have removed:

tex.generateMipMaps();

And the warning is also gone.