Does the vertex shader operates on each vertices consequently or operates on every vertices at one time? This question is related with the glVertexAttribPointer().
Let’s say I sent bunch of data into the VBO. I use glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, 0) to tell the openGL what format is our vertex array data in the buffer object is stored in and how to interpret the array of data stored in the buffer.
Let’s say I have 5 vertices here,
When I input the value to the vertex shader, what will it pass to the vertex shader? In this example, 4 values of each vertices will be passed to the vertex shader?Or every 4 values of every 5 vertices will be passed to vertex shader?
So, vertex shader operates on each vertices accordingly or 5 vertices at one time? Quite confusing here…More explanation required… =.=
Confused about your confusion…
Do this makes any difference for you ?
Because what actually happens is both complex and dependent on the hardware. Typically lots of ’ vertex threads’ will work in parallel using the same vertex shader code, each with all the values needed for one vertex.
Can explain further? I am not sure that u r talking exactly the same with mhagain?
It’s really very simple. A vertex shader is a relatively short program that is given a series of inputs, called vertex attributes. Each set of attributes represents a single vertex in the mesh. The job of the vertex shader is to output values based on those vertex attributes and parameters (called uniforms) that have been set by the outside world. So one vertex in, one vertex out.
Because the execution of each vertex shader is dependent only on its input parameters (within the scope of a single glDraw* call), the hardware is given the freedom to run multiple instances of a vertex shader simultaneously. This does not mean that any particular number of them will be run simultaneously at any particular time; that depends on how the driver decides to schedule resources. What matters is that this happens “fast”.