OpenGL ES 2.0: attribute not bound on vertex shader -


i'm developing android application.

i have following vertex shader.

"attribute vec4 vertexposition;  attribute vec4 vertexnormal;  attribute vec2 vertextexcoord;   varying vec2 texcoord;  varying vec4 normal;   uniform mat4 modelviewprojectionmatrix;   void main()  {     gl_position = modelviewprojectionmatrix * vertexposition;     normal = vertexnormal;     texcoord = vertextexcoord;  }  "; 

and fragment shader:

precision mediump float;   varying vec2 texcoord;  varying vec4 normal;   uniform sampler2d texsampler2d;  void main() {     gl_fragcolor = texture2d(texsampler2d, texcoord);  }  "; 

is there problem if left vertextexcoord unbound? think must use different vertex , fragment shader if model doesn't have texture, isn't?

thanks.

yes should have shader models without texture. otherwise, think experience implementation dependant behavior.

related that, opengl documentation says:

active attributes not explicitly bound bound linker when gllinkprogram called. locations assigned can queried calling glgetattriblocation.

so if vertex attributes enabled try vertextexcoord 1 of attributes. i'm not sure happen if no more number of attributes needed untextured model enabled , shouldn't rely on thing that. use shader.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -