gamnit: simplify asserts on GL errors
authorAlexis Laferrière <alexis.laf@xymus.net>
Mon, 18 Sep 2017 19:53:47 +0000 (15:53 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Thu, 28 Sep 2017 15:08:28 +0000 (11:08 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/gamnit/dynamic_resolution.nit
lib/gamnit/flat/flat_core.nit

index fb78730..6e9ed85 100644 (file)
@@ -81,8 +81,7 @@ redef class App
                        glViewport(0, 0, display.width, display.height)
                        glClear gl_COLOR_BUFFER_BIT | gl_DEPTH_BUFFER_BIT
 
                        glViewport(0, 0, display.width, display.height)
                        glClear gl_COLOR_BUFFER_BIT | gl_DEPTH_BUFFER_BIT
 
-                       var gl_error = glGetError
-                       assert gl_error == gl_NO_ERROR else print_error gl_error
+                       assert glGetError == gl_NO_ERROR
                        return
                end
 
                        return
                end
 
@@ -96,8 +95,7 @@ redef class App
 
                glClear gl_COLOR_BUFFER_BIT | gl_DEPTH_BUFFER_BIT
 
 
                glClear gl_COLOR_BUFFER_BIT | gl_DEPTH_BUFFER_BIT
 
-               var gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
        end
 
        # Draw the dynamic screen to the real screen if `dynamic_resolution_ratio != 1.0`
        end
 
        # Draw the dynamic screen to the real screen if `dynamic_resolution_ratio != 1.0`
@@ -131,18 +129,15 @@ redef class App
                n_floats = 2
                glEnableVertexAttribArray dynres_program.tex_coord.location
                glVertexAttribPointeri(dynres_program.tex_coord.location, n_floats, gl_FLOAT, false, 0, offset)
                n_floats = 2
                glEnableVertexAttribArray dynres_program.tex_coord.location
                glVertexAttribPointeri(dynres_program.tex_coord.location, n_floats, gl_FLOAT, false, 0, offset)
-               var gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
 
                # Draw
                glDrawArrays(gl_TRIANGLE_STRIP, 0, 4)
 
                # Draw
                glDrawArrays(gl_TRIANGLE_STRIP, 0, 4)
-               gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
 
                # Take down
                glBindBuffer(gl_ARRAY_BUFFER, 0)
 
                # Take down
                glBindBuffer(gl_ARRAY_BUFFER, 0)
-               gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
 
                sys.perfs["gamnit flat dyn res"].add app.perf_clock_dynamic_resolution.lapse
        end
 
                sys.perfs["gamnit flat dyn res"].add app.perf_clock_dynamic_resolution.lapse
        end
@@ -195,16 +190,14 @@ private class DynamicContext
                glBindFramebuffer(gl_FRAMEBUFFER, framebuffer)
                assert glIsFramebuffer(framebuffer)
                self.dynamic_framebuffer = framebuffer
                glBindFramebuffer(gl_FRAMEBUFFER, framebuffer)
                assert glIsFramebuffer(framebuffer)
                self.dynamic_framebuffer = framebuffer
-               var gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
 
                # Depth & texture/color
                var depthbuffer = glGenRenderbuffers(1).first
                self.depth_renderbuffer = depthbuffer
                var texture = glGenTextures(1).first
                self.texture = texture
 
                # Depth & texture/color
                var depthbuffer = glGenRenderbuffers(1).first
                self.depth_renderbuffer = depthbuffer
                var texture = glGenTextures(1).first
                self.texture = texture
-               gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
 
                resize(display, max_dynamic_resolution_ratio)
                assert glCheckFramebufferStatus(gl_FRAMEBUFFER) == gl_FRAMEBUFFER_COMPLETE
 
                resize(display, max_dynamic_resolution_ratio)
                assert glCheckFramebufferStatus(gl_FRAMEBUFFER) == gl_FRAMEBUFFER_COMPLETE
@@ -213,8 +206,7 @@ private class DynamicContext
                buffer_array = glGenBuffers(1).first
                glBindBuffer(gl_ARRAY_BUFFER, buffer_array)
                assert glIsBuffer(buffer_array)
                buffer_array = glGenBuffers(1).first
                glBindBuffer(gl_ARRAY_BUFFER, buffer_array)
                assert glIsBuffer(buffer_array)
-               gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
 
                ## coord
                var data = new Array[Float]
 
                ## coord
                var data = new Array[Float]
@@ -232,8 +224,7 @@ private class DynamicContext
 
                glBindBuffer(gl_ARRAY_BUFFER, 0)
 
 
                glBindBuffer(gl_ARRAY_BUFFER, 0)
 
-               gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
        end
 
        # Init size or resize `depth_renderbuffer` and `texture`
        end
 
        # Init size or resize `depth_renderbuffer` and `texture`
@@ -252,8 +243,7 @@ private class DynamicContext
                assert glIsRenderbuffer(depthbuffer)
                glRenderbufferStorage(gl_RENDERBUFFER, gl_DEPTH_COMPONENT16, width, height)
                glFramebufferRenderbuffer(gl_FRAMEBUFFER, gl_DEPTH_ATTACHMENT, gl_RENDERBUFFER, depthbuffer)
                assert glIsRenderbuffer(depthbuffer)
                glRenderbufferStorage(gl_RENDERBUFFER, gl_DEPTH_COMPONENT16, width, height)
                glFramebufferRenderbuffer(gl_FRAMEBUFFER, gl_DEPTH_ATTACHMENT, gl_RENDERBUFFER, depthbuffer)
-               var gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
 
                # Texture
                glBindTexture(gl_TEXTURE_2D, texture)
 
                # Texture
                glBindTexture(gl_TEXTURE_2D, texture)
@@ -265,15 +255,13 @@ private class DynamicContext
                             0, gl_RGB, gl_UNSIGNED_BYTE, new Pointer.nul)
                glFramebufferTexture2D(gl_FRAMEBUFFER, gl_COLOR_ATTACHMENT0, gl_TEXTURE_2D, texture, 0)
 
                             0, gl_RGB, gl_UNSIGNED_BYTE, new Pointer.nul)
                glFramebufferTexture2D(gl_FRAMEBUFFER, gl_COLOR_ATTACHMENT0, gl_TEXTURE_2D, texture, 0)
 
-               gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
 
                # Take down
                glBindRenderbuffer(gl_RENDERBUFFER, 0)
                glBindFramebuffer(gl_FRAMEBUFFER, 0)
 
 
                # Take down
                glBindRenderbuffer(gl_RENDERBUFFER, 0)
                glBindFramebuffer(gl_FRAMEBUFFER, 0)
 
-               gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
        end
 
        var destroyed = false
        end
 
        var destroyed = false
@@ -284,8 +272,7 @@ private class DynamicContext
 
                # Free the buffer
                glDeleteBuffers([buffer_array])
 
                # Free the buffer
                glDeleteBuffers([buffer_array])
-               var gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
                buffer_array = -1
 
                # Free the dynamic framebuffer and its attachments
                buffer_array = -1
 
                # Free the dynamic framebuffer and its attachments
index dcb11f6..c57a373 100644 (file)
@@ -424,8 +424,7 @@ redef class App
                var display = display
                assert display != null
 
                var display = display
                assert display != null
 
-               var gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
 
                # Prepare program
                var program = simple_2d_program
 
                # Prepare program
                var program = simple_2d_program
@@ -447,8 +446,7 @@ redef class App
                glViewport(0, 0, display.width, display.height)
                glClearColor(0.0, 0.0, 0.0, 1.0)
 
                glViewport(0, 0, display.width, display.height)
                glClearColor(0.0, 0.0, 0.0, 1.0)
 
-               gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
 
                # Prepare to draw
                for tex in all_root_textures do
 
                # Prepare to draw
                for tex in all_root_textures do
@@ -485,8 +483,7 @@ redef class App
        redef fun frame_core(display)
        do
                # Check errors
        redef fun frame_core(display)
        do
                # Check errors
-               var gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
 
                # Update game logic and set sprites
                perf_clock_main.lapse
 
                # Update game logic and set sprites
                perf_clock_main.lapse
@@ -500,8 +497,7 @@ redef class App
                display.flip
 
                # Check errors
                display.flip
 
                # Check errors
-               gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
        end
 
        private var frame_dt = 0.0
        end
 
        private var frame_dt = 0.0
@@ -1093,16 +1089,14 @@ private class SpriteContext
                buffer_array = bufs[0]
                buffer_element = bufs[1]
 
                buffer_array = bufs[0]
                buffer_element = bufs[1]
 
-               var gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
        end
 
        # Destroy `buffer_array` and `buffer_element`
        fun destroy
        do
                glDeleteBuffers([buffer_array, buffer_element])
        end
 
        # Destroy `buffer_array` and `buffer_element`
        fun destroy
        do
                glDeleteBuffers([buffer_array, buffer_element])
-               var gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
 
                buffer_array = -1
                buffer_element = -1
 
                buffer_array = -1
                buffer_element = -1
@@ -1120,8 +1114,7 @@ private class SpriteContext
                glBindBuffer(gl_ARRAY_BUFFER, buffer_array)
                assert glIsBuffer(buffer_array)
                glBufferData(gl_ARRAY_BUFFER, array_bytes, new Pointer.nul, usage)
                glBindBuffer(gl_ARRAY_BUFFER, buffer_array)
                assert glIsBuffer(buffer_array)
                glBufferData(gl_ARRAY_BUFFER, array_bytes, new Pointer.nul, usage)
-               var gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
 
                # GL_TRIANGLES 6 vertices * sprite
                var n_indices = capacity * indices_per_sprite
 
                # GL_TRIANGLES 6 vertices * sprite
                var n_indices = capacity * indices_per_sprite
@@ -1130,8 +1123,7 @@ private class SpriteContext
                glBindBuffer(gl_ELEMENT_ARRAY_BUFFER, buffer_element)
                assert glIsBuffer(buffer_element)
                glBufferData(gl_ELEMENT_ARRAY_BUFFER, element_bytes, new Pointer.nul, usage)
                glBindBuffer(gl_ELEMENT_ARRAY_BUFFER, buffer_element)
                assert glIsBuffer(buffer_element)
                glBufferData(gl_ELEMENT_ARRAY_BUFFER, element_bytes, new Pointer.nul, usage)
-               gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
 
                buffer_capacity = capacity
 
 
                buffer_capacity = capacity
 
@@ -1259,8 +1251,7 @@ private class SpriteContext
                glBindBuffer(gl_ELEMENT_ARRAY_BUFFER, buffer_element)
                glBufferSubData(gl_ELEMENT_ARRAY_BUFFER, sprite_index*6*2, 6*2, indices.native_array)
 
                glBindBuffer(gl_ELEMENT_ARRAY_BUFFER, buffer_element)
                glBufferSubData(gl_ELEMENT_ARRAY_BUFFER, sprite_index*6*2, 6*2, indices.native_array)
 
-               gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
        end
 
        # Draw all `sprites`
        end
 
        # Draw all `sprites`
@@ -1330,8 +1321,7 @@ private class SpriteContext
                        glBindTexture(gl_TEXTURE_2D, texture.gl_texture)
                        app.simple_2d_program.texture.uniform 0
                end
                        glBindTexture(gl_TEXTURE_2D, texture.gl_texture)
                        app.simple_2d_program.texture.uniform 0
                end
-               var gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
 
                var animation = animation_texture
                if animation != null then
 
                var animation = animation_texture
                if animation != null then
@@ -1339,8 +1329,7 @@ private class SpriteContext
                        glBindTexture(gl_TEXTURE_2D, animation.gl_texture)
                        app.simple_2d_program.animation_texture.uniform 1
                end
                        glBindTexture(gl_TEXTURE_2D, animation.gl_texture)
                        app.simple_2d_program.animation_texture.uniform 1
                end
-               gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
 
                # Configure attributes, in order:
                # vec4 translation, vec4 color, float scale, vec4 coord, vec2 tex_coord, vec4 rotation_row*,
 
                # Configure attributes, in order:
                # vec4 translation, vec4 color, float scale, vec4 coord, vec2 tex_coord, vec4 rotation_row*,
@@ -1354,36 +1343,31 @@ private class SpriteContext
                glEnableVertexAttribArray p.translation.location
                glVertexAttribPointeri(p.translation.location, size, gl_FLOAT, false, bytes_per_vertex, offset)
                offset += size * sizeof_gl_float
                glEnableVertexAttribArray p.translation.location
                glVertexAttribPointeri(p.translation.location, size, gl_FLOAT, false, bytes_per_vertex, offset)
                offset += size * sizeof_gl_float
-               gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
 
                size = 4
                glEnableVertexAttribArray p.color.location
                glVertexAttribPointeri(p.color.location, size, gl_FLOAT, false, bytes_per_vertex, offset)
                offset += size * sizeof_gl_float
 
                size = 4
                glEnableVertexAttribArray p.color.location
                glVertexAttribPointeri(p.color.location, size, gl_FLOAT, false, bytes_per_vertex, offset)
                offset += size * sizeof_gl_float
-               gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
 
                size = 1
                glEnableVertexAttribArray p.scale.location
                glVertexAttribPointeri(p.scale.location, size, gl_FLOAT, false, bytes_per_vertex, offset)
                offset += size * sizeof_gl_float
 
                size = 1
                glEnableVertexAttribArray p.scale.location
                glVertexAttribPointeri(p.scale.location, size, gl_FLOAT, false, bytes_per_vertex, offset)
                offset += size * sizeof_gl_float
-               gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
 
                size = 4
                glEnableVertexAttribArray p.coord.location
                glVertexAttribPointeri(p.coord.location, size, gl_FLOAT, false, bytes_per_vertex, offset)
                offset += size * sizeof_gl_float
 
                size = 4
                glEnableVertexAttribArray p.coord.location
                glVertexAttribPointeri(p.coord.location, size, gl_FLOAT, false, bytes_per_vertex, offset)
                offset += size * sizeof_gl_float
-               gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
 
                size = 2
                glEnableVertexAttribArray p.tex_coord.location
                glVertexAttribPointeri(p.tex_coord.location, size, gl_FLOAT, false, bytes_per_vertex, offset)
                offset += size * sizeof_gl_float
 
                size = 2
                glEnableVertexAttribArray p.tex_coord.location
                glVertexAttribPointeri(p.tex_coord.location, size, gl_FLOAT, false, bytes_per_vertex, offset)
                offset += size * sizeof_gl_float
-               gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
 
                size = 4
                for r in [p.rotation_row0, p.rotation_row1, p.rotation_row2, p.rotation_row3] do
 
                size = 4
                for r in [p.rotation_row0, p.rotation_row1, p.rotation_row2, p.rotation_row3] do
@@ -1392,65 +1376,56 @@ private class SpriteContext
                                glVertexAttribPointeri(r.location, size, gl_FLOAT, false, bytes_per_vertex, offset)
                        end
                        offset += size * sizeof_gl_float
                                glVertexAttribPointeri(r.location, size, gl_FLOAT, false, bytes_per_vertex, offset)
                        end
                        offset += size * sizeof_gl_float
-                       gl_error = glGetError
-                       assert gl_error == gl_NO_ERROR else print_error gl_error
+                       assert glGetError == gl_NO_ERROR
                end
 
                size = 1
                glEnableVertexAttribArray p.animation_fps.location
                glVertexAttribPointeri(p.animation_fps.location, size, gl_FLOAT, false, bytes_per_vertex, offset)
                offset += size * sizeof_gl_float
                end
 
                size = 1
                glEnableVertexAttribArray p.animation_fps.location
                glVertexAttribPointeri(p.animation_fps.location, size, gl_FLOAT, false, bytes_per_vertex, offset)
                offset += size * sizeof_gl_float
-               gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
 
                size = 1
                glEnableVertexAttribArray p.animation_n_frames.location
                glVertexAttribPointeri(p.animation_n_frames.location, size, gl_FLOAT, false, bytes_per_vertex, offset)
                offset += size * sizeof_gl_float
 
                size = 1
                glEnableVertexAttribArray p.animation_n_frames.location
                glVertexAttribPointeri(p.animation_n_frames.location, size, gl_FLOAT, false, bytes_per_vertex, offset)
                offset += size * sizeof_gl_float
-               gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
 
                size = 2
                glEnableVertexAttribArray p.animation_coord.location
                glVertexAttribPointeri(p.animation_coord.location, size, gl_FLOAT, false, bytes_per_vertex, offset)
                offset += size * sizeof_gl_float
 
                size = 2
                glEnableVertexAttribArray p.animation_coord.location
                glVertexAttribPointeri(p.animation_coord.location, size, gl_FLOAT, false, bytes_per_vertex, offset)
                offset += size * sizeof_gl_float
-               gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
 
                size = 2
                glEnableVertexAttribArray p.animation_tex_coord.location
                glVertexAttribPointeri(p.animation_tex_coord.location, size, gl_FLOAT, false, bytes_per_vertex, offset)
                offset += size * sizeof_gl_float
 
                size = 2
                glEnableVertexAttribArray p.animation_tex_coord.location
                glVertexAttribPointeri(p.animation_tex_coord.location, size, gl_FLOAT, false, bytes_per_vertex, offset)
                offset += size * sizeof_gl_float
-               gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
 
                size = 2
                glEnableVertexAttribArray p.animation_tex_diff.location
                glVertexAttribPointeri(p.animation_tex_diff.location, size, gl_FLOAT, false, bytes_per_vertex, offset)
                offset += size * sizeof_gl_float
 
                size = 2
                glEnableVertexAttribArray p.animation_tex_diff.location
                glVertexAttribPointeri(p.animation_tex_diff.location, size, gl_FLOAT, false, bytes_per_vertex, offset)
                offset += size * sizeof_gl_float
-               gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
 
                size = 1
                glEnableVertexAttribArray p.animation_start.location
                glVertexAttribPointeri(p.animation_start.location, size, gl_FLOAT, false, bytes_per_vertex, offset)
                offset += size * sizeof_gl_float
 
                size = 1
                glEnableVertexAttribArray p.animation_start.location
                glVertexAttribPointeri(p.animation_start.location, size, gl_FLOAT, false, bytes_per_vertex, offset)
                offset += size * sizeof_gl_float
-               gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
 
                size = 1
                glEnableVertexAttribArray p.animation_loops.location
                glVertexAttribPointeri(p.animation_loops.location, size, gl_FLOAT, false, bytes_per_vertex, offset)
                offset += size * sizeof_gl_float
 
                size = 1
                glEnableVertexAttribArray p.animation_loops.location
                glVertexAttribPointeri(p.animation_loops.location, size, gl_FLOAT, false, bytes_per_vertex, offset)
                offset += size * sizeof_gl_float
-               gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
 
                # Actual draw
                for s in sprites.starts, e in sprites.ends do
                        var l = e-s
                        glDrawElementsi(gl_TRIANGLES, l*indices_per_sprite, gl_UNSIGNED_SHORT, 2*s*indices_per_sprite)
 
                # Actual draw
                for s in sprites.starts, e in sprites.ends do
                        var l = e-s
                        glDrawElementsi(gl_TRIANGLES, l*indices_per_sprite, gl_UNSIGNED_SHORT, 2*s*indices_per_sprite)
-                       gl_error = glGetError
-                       assert gl_error == gl_NO_ERROR else print_error gl_error
+                       assert glGetError == gl_NO_ERROR
                end
 
                # Take down
                end
 
                # Take down
@@ -1458,14 +1433,12 @@ private class SpriteContext
                             p.rotation_row0, p.rotation_row1, p.rotation_row2, p.rotation_row3: Attribute] do
                        if not attr.is_active then continue
                        glDisableVertexAttribArray(attr.location)
                             p.rotation_row0, p.rotation_row1, p.rotation_row2, p.rotation_row3: Attribute] do
                        if not attr.is_active then continue
                        glDisableVertexAttribArray(attr.location)
-                       gl_error = glGetError
-                       assert gl_error == gl_NO_ERROR else print_error gl_error
+                       assert glGetError == gl_NO_ERROR
                end
 
                glBindBuffer(gl_ARRAY_BUFFER, 0)
                glBindBuffer(gl_ELEMENT_ARRAY_BUFFER, 0)
                end
 
                glBindBuffer(gl_ARRAY_BUFFER, 0)
                glBindBuffer(gl_ELEMENT_ARRAY_BUFFER, 0)
-               gl_error = glGetError
-               assert gl_error == gl_NO_ERROR else print_error gl_error
+               assert glGetError == gl_NO_ERROR
        end
 end
 
        end
 end