api - what is the opengl current vertex? -
this found in opengl documentation:
void glgetvertexattribfv(gluint index, glenum pname, glfloat *params); gl_current_vertex_attrib params returns 4 values represent current value generic vertex attribute specified index. generic vertex attribute 0 unique in has no current state, error generated if index 0. initial value other generic vertex attributes (0,0,0,1). glgetvertexattribdv , glgetvertexattribfv return current attribute values 4 single-precision floating-point values; glgetvertexattribiv reads them floating-point values , converts them 4 integer values; glgetvertexattribiiv , glgetvertexattribiuiv read , return them signed or unsigned integer values, respectively; glgetvertexattribldv reads , returns them 4 double-precision floating-point values.
but problem is, have no idea current vertex is. how set current vertex? can use test weather attributes i've sent opengl contain correct data?
glgetvertexattrib
returns value associated generic vertex attribute, can set glvertexattrib
function.
in more detail, there 2 types of attributes available in opengl:
- those updated each vertex enabled vertex arrays processed when draw call (e.g.,
gldrawarrays
) executed. - those sort of act shader uniforms, used provide values attributes don't have associated, enabled set vertex array.
for example, let's enable 2 arrays use vertex attributes using glvertexattribpointer
, , glenablevertexattribarray
, , render calling gldrawarrays( gl_points, 0, numpoints )
. in case, bound vertex shader executed numpoints
times, each time new value read each of 2 arrays.
however, if enabled on array (say, vertex array zero), set attribute value attribute 1 using of glvertexattrib
functions. if once again rendering calling gldrawarrays( gl_points, 0, numpoints )
, vertex shader again executed numpoints
times, attribute zero's values being update values enabled vertex attribute array, attribute one's values being "constant", , set value provided glvertexattrib
.
Comments
Post a Comment