c++ - Trying to understand OpenGL shaders for input vertices -


this question has answer here:

here code begin with, vertex shader

"#version 400\n"       "layout(location =  0) in vec2 vp;"       "layout(location = 1) in vec2 tex;"       "out vec2 texcoord;"       "void main () {"       "  gl_position = vec4 (vp, 0.0f, 1.0f);"       "  texcoord = tex; "       "}"; 

quiet common , basic

so trying understand, vertex shader run every vertex attribute separately ? or runs 1 attribute individually?

as far have understood if give input vertices triangle

  x    y    u   v {-0.5,-0.5, 0.0, 0.0  0.5, -0.5 , 1.0, 0.0  0.0  0.0 , 0.5, 1.0 }; 

does mean vertex shader run both of vertex attributes , produce each individual fragment within area of both triangles (sample) result in xy coordinates both of defined triangles each attribute?

or vertex shader run gl_position produce xy coordinates area in first attribute i.e vp?

the entire shader program runs once per vertex. in case, runs 3 times. doesn't work per-attribute.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -