[ad_1]
I am developping an OpenGLes 3.0 app with Java and I began writing the shader code. For some cause, it appears to combine up the attributes knowledge places and I do not perceive why. Here is the code :
Vertex shader:
#model 300 es
precision mediump float;
in vec3 place;
in vec2 uv;
in vec3 regular;
uniform mat4 remodel;
uniform mat4 projection;
out f_norm;
void principal(){
//f_norm = regular;
gl_Position = projection*remodel*vec4(place,1.0);
}
Fragment Shader :
#model 300 es
precision mediump float;
in f_norm;
out vec4 Fragment;
void principal(){
Fragment = vec4(1.0);
}
I bind the VBOs utilizing these traces :
GLES30.glBindAttribLocation(ProgramID,0,"place");
GLES30.glBindAttribLocation(ProgramID,1,"uv");
GLES30.glBindAttribLocation(ProgramID,2,"regular");
Within the present type, this system works simply high-quality, but when I uncomment this line : f_norm = regular
, within the vertex shader, out of the blue it makes use of uv coordinates as positions, despite the fact that they are not used.
I do know the info and the info mapping is okay : it really works once I remark out the above line.
I do know the binding is occurring : it is extremely explicitly known as, with the correct values, once I verify with the debugger.
I made positive that each one the VBOs are correctly allow and disable earlier than and after the draw name.
I discovered a simple workaround ( specify format(location = <VBO>)
in entrance of the variables), however I would prefer to know what’s taking place right here, to get a extra everlasting repair.
[ad_2]