I'm a beginner with OpenGL so please forgive me if this "issue" is something wrong with my implementation/understanding. I'm building a very simple graph plotter using SharpGL and "modern OpenGL", and I found that the same project was giving two different outputs on two different computers. After some debugging I traced it down to the fact that two of my shader attributes were being assigned to different numbers on the two computers. So if I didn't use shaderProgram.BindAttributeLocation() and just read back the ID from the shader, things were working fine. i.e.
/* Not Working Code */
attribute_vpos = 0;
attribute_vcol = 1;
...
shaderProgram.BindAttributeLocation(gl, attribute_vpos, "vPosition");
shaderProgram.BindAttributeLocation(gl, attribute_vcol, "vColor");
// Gives expected figure on one PC not on the other
// Replacing the above 2 lines with this works:
attribute_vpos = (uint)gl.GetAttribLocation(shaderProgram.ShaderProgramObject, "vPosition");
attribute_vcol = (uint)gl.GetAttribLocation(shaderProgram.ShaderProgramObject, "vColor");
Checking the attribute IDs on the not-working PC, attribute_vpos was 0 but attribute_vcol was not 1, but some other random (big) integer. So I presume somehow the binding to the shaderProgram.BindAttributeLocation(gl, attribute_vcol, "vColor") was not able to bind the vColor attribute to integer 1.
Hi,
I'm a beginner with OpenGL so please forgive me if this "issue" is something wrong with my implementation/understanding. I'm building a very simple graph plotter using SharpGL and "modern OpenGL", and I found that the same project was giving two different outputs on two different computers. After some debugging I traced it down to the fact that two of my shader attributes were being assigned to different numbers on the two computers. So if I didn't use
shaderProgram.BindAttributeLocation()
and just read back the ID from the shader, things were working fine. i.e.Checking the attribute IDs on the not-working PC,
attribute_vpos
was 0 butattribute_vcol
was not 1, but some other random (big) integer. So I presume somehow the binding to theshaderProgram.BindAttributeLocation(gl, attribute_vcol, "vColor")
was not able to bind the vColor attribute to integer 1.I'm using SharpGL v2.3.0.1
Govind