I have a problem with fragment shader in libgdx. Below is a fragment of a 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 the 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 () returns true, and the first set works fine, but in the second I have the error "there is no uniform named" u_aspectRatio "in the shader." If the delete line is:
uniform float u_aspectRatio;
everything works fine from shader, but when I add this line (in the function I want to work with this object) and try to install some data, I have an error.
source
share