我在libgdx中有片段着色器问题。以下是我的片段着色器。片段着色器:在着色器中没有统一名称
#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);
}
在节目我做
shader.setUniformi("u_texture", 0); // work fine
shader.setUniformf("u_aspectRatio", 0.0f); //no uniform with name 'u_aspectRatio' in shader
shader.isCompiled()返回true和第一套做工精细,但在第二次我有错误“名为‘u_aspectRatio’着色器没有统一的”。如果删除行:
uniform float u_aspectRatio;
从着色器都工作正常,但是当我加入这一行(在功能,我想与此对象的工作),并尝试建立一些数据我有错误。
我找到答案。在着色器不能统一哪个不使用psobject – Dima