texture2D weird behavior

I’m implementing my own Phong shading without using opengl lights in opengl 2.0 (desktop, not ES).
Everything works fine but when I use texture2D things go a bit crazy.
Basically just calling texture2D changes the behavior of my shader and lights don’t work in the way they do without texture2D.
On my machine I managed to solve this problem creating a function and calling texture2D inside this function instead of main. It doesn’t make any sense to me but it works. On other machines this “solution” works randomly based on the machine.
Do you know if texture2D has some weird behavior in opengl 2.0?

Best post your shader; texture2D just effects the colour feed into the equations nothing else.

Never mind, the problem is fixed :slight_smile: it was outside of the shader itself.
The fact that calling a function inside the shader was fixing it still does not make any sense at all but at least everything is working now!