hello all !
i try set atributes on vertex
shader:
Code:
uniform mat4 u_mvpMatrix;
attribute vec4 a_position;
void main()
{
gl_Position = u_mvpMatrix* a_position;
}
and code init
Code:
loading init shader ....
and
mvpLoc = glGetUniformLocation( prog, "u_mvpMatrix" );
a_position = glGetAttribLocation(prog, "a_position");
glEnableVertexAttribArray(a_position);
draw code
Code:
glUniformMatrix4fv( mvpLoc, 1, GL_FALSE, (GLfloat*) &mvpMatrix.m[0][0] );
glVertexAttribPointer(a_position,4,GL_FLOAT,0,0,position);
glDrawElements(GL_TRIANGLES, 3*numIndicles, GL_UNSIGNED_SHORT, &Indicles);
struct position
Code:
typedef struct
{
float x,y,z,w;
}positionStruct;
positionStruct*position;
position[0].x = 0;
position[0].y = 0;
position[0].z = 0;
position[0].w = 0;
position[1].x = 1;
position[1].y = 0;
position[1].z = 0;
position[1].w = 0;
position[2].x = 2;
position[2].y = 0;
position[2].z = 0;
position[2].w = 0;
ets ....
The primitive thing not to be displayed
but if i del
Code:
glVertexAttribPointer(a_position,4,GL_FLOAT,0,0,position);
how correct set attributes array on vertex ? idarkstranger2009-07-02 19:47:17