Skip to main content
GameDev.net gamedev.net
🔒 Locked 🎮 Unity

c# glDrawElements

Started by bitskull Jan 8, 2007 at 12:32 AM 0 replies 1.1k views
Original Post
bitskull
bitskull
Hi, I render models using this code which works perfectly: GL.glBegin(GL.GL_TRIANGLES); for (int j = 0; j < vertexIndices.Length; ++j) { Vector3 v = (Vector3)vertexArray[(int)vertexIndices[j]]; GL.glVertex3f(v.X, v.Y, v.Z); } GL.glEnd(); However I cant get it working using glDrawElements: GL.glEnableClientState(GL.GL_VERTEX_ARRAY); GL.glVertexPointer(3, GL.GL_FLOAT, 0, vertexArray); GL.glDrawElements(GL.GL_TRIANGLES, NumTriangles * 3, GL.GL_UNSIGNED_int, vertexIndices); GL.glDisableClientState(GL.GL_VERTEX_ARRAY); uint error = GL.glGetError(); if (error != GL.GL_NO_ERROR) System.Console.WriteLine("glDrawElements error"); It compiles fine but renders nothing. There is no "glDrawElements error" written. vertexArray and vertexIndices definition: private object[] vertexArray; private object[] vertexIndices; Thx for tips.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.