I 've been trying to draw a mesh using Index Arrays. The mesh is a result mapping each pixel of a picture on 3D space (with z initially being 0) and triangulating CCW, starting from the upperleft corner, moving South and then North-East to complete the first triangle, and then South and West for the second. So GL_TRIANGLES must be my choice.
I'm using C#/Tao.
I have the following code:
FillFaceArrays() function fills the Varray, Narray and Iarray with the Vertex Normal and Index data respectively. Varray and Narray are of type double and Iarray is int.Code :try { int err = Gl.GL_NO_ERROR; //Fill the Arrays with any possible changes FillFaceArrays(); //Activate the Arrays Gl.glEnableClientState(Gl.GL_VERTEX_ARRAY); Gl.glEnableClientState(Gl.GL_NORMAL_ARRAY); //Load the arrays Gl.glVertexPointer(3, Gl.GL_DOUBLE, 0, Varray.ToRowWiseArray()); Gl.glNormalPointer(Gl.GL_DOUBLE, 0, Narray.ToRowWiseArray()); err = Gl.glGetError(); if (err != Gl.GL_NO_ERROR) throw new Exception(Glu.gluErrorString(err)); //Draw!!! Gl.glColor3ub(255, 0, 0); Gl.glDrawElements(Gl.GL_TRIANGLES, Iarray.Length, Gl.GL_INT, Iarray); err = Gl.glGetError(); if (err != Gl.GL_NO_ERROR) throw new Exception(Glu.gluErrorString(err)); //Deactivate the Arrays Gl.glDisableClientState(Gl.GL_VERTEX_ARRAY); Gl.glDisableClientState(Gl.GL_NORMAL_ARRAY); } catch (Exception ex) { MessageBox.Show(ex.Message); }
After calling glDrawElements, I get a 1280:GL_INVALID_ENUM error which I cannot justify.
I thank you



.
. Sorry.