Hello everyone !
I have a strange problem with basic shaders in GLSL that struggles me, using OpenGL ES 2.0 on Android. (Main program is in Java)
Here's the vertex shader :
attribute vec4 position;
attribute vec2 iTexCoord;
attribute vec4 iColor;
attribute float iAngle;
uniform mat4 vpMatrix;
varying vec2 oTexCoord;
varying vec4 oColor;
varying float oAngle;
void main() {
oTexCoord = iTexCoord;
oColor = iColor;
oAngle = iAngle;
gl_Position = vpMatrix * position;
}
And here's the fragment shader
precision mediump float;
varying vec2 oTexCoord;
varying vec4 oColor;
varying float oAngle;
uniform sampler2D sampler;
void main() {
gl_FragColor = texture2D(sampler, oTexCoord / 4.0 + vec2(0.0, 0.8)) * oColor;
}
Whatever I do, gl_FragColor is always sampled from oTexCoord. Even if my rule of 3 is designed to sample a normal map in the last row of the color map. (All is in a regular sprite sheet).
I'm really new to GLSL(even if I used HLSL before), so this should be a dumb question.
Thanks.
:rolleyes: