From: Alexis Laferrière Date: Sat, 12 Sep 2015 14:30:25 +0000 (-0400) Subject: lib/glesv2: move some services out of `VertexArray` as per the new style X-Git-Tag: v0.7.8~28^2~3 X-Git-Url: http://nitlanguage.org lib/glesv2: move some services out of `VertexArray` as per the new style Signed-off-by: Alexis Laferrière --- diff --git a/lib/glesv2/examples/opengles2_hello_triangle.nit b/lib/glesv2/examples/opengles2_hello_triangle.nit index 48d49ab..3a1e1c5 100644 --- a/lib/glesv2/examples/opengles2_hello_triangle.nit +++ b/lib/glesv2/examples/opengles2_hello_triangle.nit @@ -168,7 +168,7 @@ for i in [0..10000[ do gl.clear((new GLBuffer).color) program.use vertex_array.enable - vertex_array.draw_arrays_triangles + glDrawArrays(new GLDrawMode.triangles, 0, 3) egl_display.swap_buffers(surface) end diff --git a/lib/glesv2/glesv2.nit b/lib/glesv2/glesv2.nit index 4e3c3ee..474b4aa 100644 --- a/lib/glesv2/glesv2.nit +++ b/lib/glesv2/glesv2.nit @@ -314,15 +314,22 @@ class VertexArray glVertexAttribPointer(index, count, GL_FLOAT, GL_FALSE, 0, array); `} - fun enable do enable_intern(index) - private fun enable_intern(index: Int) `{ glEnableVertexAttribArray(index); `} + # Enable this vertex attribute array + fun enable do glEnableVertexAttribArray(index) - fun draw_arrays_triangles do draw_arrays_triangles_intern(index, count) - private fun draw_arrays_triangles_intern(index, count: Int) `{ - glDrawArrays(GL_TRIANGLES, index, count); - `} + # Disable this vertex attribute array + fun disable do glDisableVertexAttribArray(index) end +# Enable the generic vertex attribute array at `index` +fun glEnableVertexAttribArray(index: Int) `{ glEnableVertexAttribArray(index); `} + +# Disable the generic vertex attribute array at `index` +fun glDisableVertexAttribArray(index: Int) `{ glDisableVertexAttribArray(index); `} + +# Render primitives from array data +fun glDrawArrays(mode: GLDrawMode, from, count: Int) `{ glDrawArrays(mode, from, count); `} + # Low level array of `Float` class GLfloatArray super CArray[Float]