I'm trying to use glVertexPointer function from Tao framework without much luck. Following sample draws nothing (commented out lines do draw triangle).
Initialization code:
float[] coord = new float[16];
float[] color = new float[16];
// all white
for (int i = 0; i < 16; i++)
color[i] = 1;
// triangle
coord[0] = 0.5f;
coord[1] = 1;
coord[2] = 0;
coord[3] = 0;
coord[4] = 0;
coord[5] = 0;
coord[6] = 1;
coord[7] = 0;
coord[8] = 0;
Gl.glClearColor(1f, 0f, 0f, 1f);
Gl.glMatrixMode(Gl.GL_PROJECTION);
Gl.glLoadIdentity();
Gl.glOrtho(0, 1, 0, 1, -1, 1);
and then in render loop
Gl.glColor3f(0, 1, 0);
// this works
//Gl.glBegin(Gl.GL_TRIANGLES);
//Gl.glVertex3f(0.5f, 1f, 0); Gl.glVertex3f(0, 0, 0); Gl.glVertex3f(1f, 0, 0);
//Gl.glEnd();
// this doesn't
Gl.glEnableClientState(Gl.GL_VERTEX_ARRAY);
Gl.glEnableClientState(Gl.GL_COLOR_ARRAY);
Gl.glVertexPointer(3, Gl.GL_FLOAT, 0, coord[0]);
Gl.glColorPointer(3, Gl.GL_FLOAT, 0, color[0]);
Gl.glDrawArrays(Gl.GL_TRIANGLES, 0, 3);
Gl.glDisableClientState(Gl.GL_VERTEX_ARRAY);
Gl.glDisableClientState(Gl.GL_COLOR_ARRAY);
Both arrays have 3 elements per vertex, 0 stride (tightly packed). Debugger shows correct values in memory. I guess it's some glitch in Tao or between managed and unmanaged code... Any advice would be appreciated.