Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
update dt
# Draw and flip screen
update dt
# Draw and flip screen
+ frame_core_draw display
+ display.flip
+
+ # Check errors
+ gl_error = glGetError
+ assert gl_error == gl_NO_ERROR else print gl_error
+ end
+
+ # 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
# TODO optimize this draw to store constant values on the GPU
simple_2d_program.use
simple_2d_program.mvp.uniform world_camera.mvp_matrix
for sprite in sprites do sprite.draw
simple_2d_program.use
simple_2d_program.mvp.uniform world_camera.mvp_matrix
for sprite in sprites do sprite.draw
- ## Reset only the depth buffer
+ # Reset only the depth buffer
glClear gl_DEPTH_BUFFER_BIT
glClear gl_DEPTH_BUFFER_BIT
simple_2d_program.mvp.uniform ui_camera.mvp_matrix
for sprite in ui_sprites do sprite.draw
simple_2d_program.mvp.uniform ui_camera.mvp_matrix
for sprite in ui_sprites do sprite.draw
- display.flip
-
- # Check errors
- gl_error = glGetError
- assert gl_error == gl_NO_ERROR else print gl_error
end
# Main method to refine in clients to update game logic and `sprites`
end
# Main method to refine in clients to update game logic and `sprites`