First of all, this is not a GLSL shader.
float2
, half4
, tex2D (...)
, : SV_POSITION
, etc. are all HLSL / Cg.
What is more, the modulus operator is not going to work in GLSL on a floating-point type.
The %
operator may not even work on an integer type if your GPU does not support GL_EXT_gpu_shader4
. You could use the built-in mod (...)
function, but again your shader is not actually GLSL to begin with.
UPDATE:
You are currently mismatching the dimensionality of mod (...)
. It will return a floating-point scalar, but you are trying to store that in a vec2
.
Use this instead:
void main() {
vec2 modXZ = vec2 (mod (a_position.x, u_widthImg),
mod (a_position.z, u_heightImg));
v_texCoord0 = modXZ / vec2 (u_widthImg, u_heightImg);
gl_Position = u_projTrans * u_worldTrans * vec4(a_position, 1.0);
}
As for the last error in your question, that comes from your fragment shader, which you have not shown. I know this because the line number is out-of-synch with the others and the only z
swizzle in your shader is for a_position
, which is declared as vec3
.