From 563519d9218ec399e3695facb6fb751d6aece012 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Sun, 17 Jan 2016 16:25:35 -0500 Subject: [PATCH] lib/gamnit flat: set array_enabled settings at each frame MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- lib/gamnit/flat.nit | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/gamnit/flat.nit b/lib/gamnit/flat.nit index 24a72c8..eaa5ba8 100644 --- a/lib/gamnit/flat.nit +++ b/lib/gamnit/flat.nit @@ -155,14 +155,6 @@ redef class App gamnit_error = tex.error assert gamnit_error == null else print_error gamnit_error end - - # Constant program values - program.use - program.coord.array_enabled = true - program.tex_coord.array_enabled = true - - gl_error = glGetError - assert gl_error == gl_NO_ERROR else print gl_error end redef fun frame_core(display) @@ -190,10 +182,15 @@ redef class App # Draw sprites in `sprites` and `ui_sprites` protected fun frame_core_draw(display: GamnitDisplay) do - # TODO optimize this draw to store constant values on the GPU + simple_2d_program.use + + # Set constant configs + simple_2d_program.coord.array_enabled = true + simple_2d_program.tex_coord.array_enabled = true + simple_2d_program.color.array_enabled = false + # TODO optimize this draw to store constant values on the GPU # World sprites - simple_2d_program.use simple_2d_program.mvp.uniform world_camera.mvp_matrix for sprite in sprites do sprite.draw -- 1.7.9.5