From e80bbe24186e3b0799436c318268cf8169e5e742 Mon Sep 17 00:00:00 2001 From: Roz K Date: Sun, 1 Jan 2023 07:57:10 +0100 Subject: [PATCH] Remove begin_frame and end_frame, add clear_buffer. --- __init__.py | 11 ++++++----- cpp/render.hpp | 7 ++++--- cpp/render/render_opengles.cpp | 10 +++++----- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/__init__.py b/__init__.py index 2e64991..fcb86c6 100644 --- a/__init__.py +++ b/__init__.py @@ -385,8 +385,12 @@ create_batch.argtypes = ( ctypes.c_uint, # max_meshes ctypes.c_char_p) # params_format -begin_frame = _engine.rk_begin_frame -begin_frame.restype = None +clear_buffer = _engine.rk_clear_buffer +clear_buffer.restype = None +clear_buffer.argtypes = ( + ctypes.c_bool, # pixels + ctypes.c_bool, # depth + ctypes.c_bool) # stencil select_shader = _engine.rk_select_shader select_shader.restype = None @@ -460,9 +464,6 @@ unselect_shader.restype = None unselect_shader.argtypes = ( ctypes.c_void_p,) # shader -end_frame = _engine.rk_end_frame -end_frame.restype = None - destroy_batch = _engine.rk_destroy_batch destroy_batch.restype = None destroy_batch.argtypes = ( diff --git a/cpp/render.hpp b/cpp/render.hpp index 9ee9d71..5bd2abd 100644 --- a/cpp/render.hpp +++ b/cpp/render.hpp @@ -124,7 +124,10 @@ RK_EXPORT rk_batch_t rk_create_batch( rk_uint max_meshes, rk_param_format const * params_format); -RK_EXPORT void rk_begin_frame(); +RK_EXPORT void rk_clear_buffer( + rk_bool pixels, + rk_bool depth, + rk_bool stencil); RK_EXPORT void rk_select_shader( rk_shader_t _shader); @@ -174,8 +177,6 @@ RK_EXPORT void rk_unselect_texture( RK_EXPORT void rk_unselect_shader( rk_shader_t shader); -RK_EXPORT void rk_end_frame(); - RK_EXPORT void rk_destroy_batch( rk_batch_t batch); diff --git a/cpp/render/render_opengles.cpp b/cpp/render/render_opengles.cpp index c71b907..acd1320 100644 --- a/cpp/render/render_opengles.cpp +++ b/cpp/render/render_opengles.cpp @@ -676,8 +676,11 @@ rk_batch_t rk_create_batch( return reinterpret_cast(batch); } -void rk_begin_frame() { - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); +void rk_clear_buffer( + rk_bool pixels, + rk_bool depth, + rk_bool stencil) { + glClear((GL_COLOR_BUFFER_BIT * pixels) | (GL_DEPTH_BUFFER_BIT * depth) | (GL_STENCIL_BUFFER_BIT * stencil)); } void rk_select_shader( @@ -908,9 +911,6 @@ void rk_unselect_shader( glUseProgram(0); } -void rk_end_frame() { -} - void rk_destroy_batch( rk_batch_t _batch) { rk_batch * const batch = reinterpret_cast(_batch);