I have problem with fragment shader in libgdx. Below is my fragment shader.
#ifdef GL_ES precision mediump float; #endif uniform float u_aspectRatio; varying vec2 v_texCoords; uniform sampler2D u_texture; void main() { gl_FragColor = texture2D(u_texture, v_texCoords); }
In program I do
shader.setUniformi("u_texture", 0); // work fine shader.setUniformf("u_aspectRatio", 0.0f); //no uniform with name 'u_aspectRatio' in shader
shader.isCompiled() return true and first set work fine, but in second I have error "no uniform with name 'u_aspectRatio' in shader". If delete line:
uniform float u_aspectRatio;
from shader all work fine, but when I add this line(in feature I want work with this object) and try set some data I have error.