Shader : Affect an effect on a texture before it is mapped

Hi !

A beginner question concerning shaders.

I’m trying to use a shader on a sphere.
I want to apply my shader on a square image I’m using that will be mapped around the sphere.
Once my flat texture has it’s effet, I wanted this modified texture be maped around the sphere.

In the following code, the shader is affectig my whole render for an obivous reason.
I can’t manage to do anything on my texture before it get’s mapped around my shpere.

I’d like to know how to tread my incoming texture as a plane, knowing that it will be applied around my sphere after my “texture” function. This should be done in a same shader.

The vertex shader is ok
Here’s the fragment shader

#version 150

uniform sampler2DRect tex0;
in vec2 varyingtexcoord;
uniform sampler2DRect My_image;
out vec4 outputColor;

void main()
{
    float windowWidth = 1024.0;
    float windowHeight = 768.0;
 
    vec4 inter = texture(tex0,varyingtexcoord);
    vec2 interp = gl_FragCoord.xy / vec2(windowWidth, windowHeight);
    
    outputColor = inter * sin(interp.y*2*3.14-0.5);
}

Thanks for your answers

Nicolas

I found a solution that requires two shaders. It works but It brings some complications that I would like to avoid.

1- using an fbo on which I process my rectangular image with a shader, here the vertex shader does nothing
2- using the fbo as a texture input of a shader to process the verticles, where the fragment shader does nothing

I seems logic to use 2 shaders as the order is first process the verticles, and then the pixels. In my case I want to do the opposit.

I still wonder if there is a way to use one single shader to do this.
any info ?

Nico