In es 1.0, I was able to use indexing into an existing vertex buffer in the glDrawElements method. This allowed me to specify only 4 points for drawing a square or rectangle. without the indexing I would have needed 6 points making up 2 triangles. How could I do this in ES 2.0?
satya - Fri Jul 27 2012 11:01:14 GMT-0400 (Eastern Daylight Time)
glVertexAttribPointer index
glVertexAttribPointer index
satya - Fri Jul 27 2012 11:01:42 GMT-0400 (Eastern Daylight Time)
a good attempt at stackoverflow
satya - Fri Jul 27 2012 11:15:32 GMT-0400 (Eastern Daylight Time)
Reusing vertices glVertexAttrib pointer
Reusing vertices glVertexAttrib pointer
satya - Fri Jul 27 2012 11:23:34 GMT-0400 (Eastern Daylight Time)
The index in glVertexAttribPointer referes to
#version 400
layout(location=0) in vec4 in_Position;
layout(location=1) in vec4 in_Color;
out vec4 ex_Color;
void main(void)
{
gl_Position = in_Position;
ex_Color = in_Color;
}
satya - Fri Jul 27 2012 11:24:33 GMT-0400 (Eastern Daylight Time)
refers to the location numbers indicating variable names
for instance the variable in_Position refers to the index of 0.
satya - Fri Jul 27 2012 12:29:18 GMT-0400 (Eastern Daylight Time)
Real nice. This may be the solution: IBO
satya - Fri Jul 27 2012 12:30:26 GMT-0400 (Eastern Daylight Time)
This is a superb effort:http://openglbook.com/
satya - Fri Jul 27 2012 12:34:24 GMT-0400 (Eastern Daylight Time)
GL_ELEMENT_ARRAY_BUFFER for indices?
GL_ELEMENT_ARRAY_BUFFER for indices?
satya - Fri Jul 27 2012 12:35:25 GMT-0400 (Eastern Daylight Time)
use glDrawElements and not glDrawArrays. There you go!
use glDrawElements and not glDrawArrays. There you go!
satya - Fri Jul 27 2012 12:35:44 GMT-0400 (Eastern Daylight Time)
glDrawElements
glDrawElements
satya - Fri Jul 27 2012 12:38:39 GMT-0400 (Eastern Daylight Time)
Signature of this function
void glDrawElements( GLenum mode,
GLsizei count,
GLenum type,
const GLvoid * indices);
Notice the indices argument.
satya - Fri Jul 27 2012 12:40:46 GMT-0400 (Eastern Daylight Time)
This function exists in the Android Binding as well