Add a parameter to enable/disable debug output.

This commit is contained in:
Roz K 2022-12-30 14:11:48 +01:00
parent 7db5304d40
commit 306ac3d312
Signed by: roz
GPG Key ID: 51FBF4E483E1C822
3 changed files with 11 additions and 4 deletions

View File

@ -279,6 +279,9 @@ INSTANCE_FLAG_VISIBLE = _flag(1)
BATCH_MAX_SIZE = 65536
render_initialize = _engine.rk_render_initialize
render_initialize.argtypes = (
ctypes.c_bool,) # debug
render_terminate = _engine.rk_render_terminate
_load_shader = _engine.rk_load_shader

View File

@ -80,7 +80,8 @@ union rk_mesh {
};
};
RK_EXPORT void rk_render_initialize();
RK_EXPORT void rk_render_initialize(
rk_bool debug);
RK_EXPORT void rk_render_terminate();

View File

@ -49,7 +49,8 @@ static void rk_debug_message_callback(
printf("[GL] (id=%d) %s\n", id, message);
}
void rk_render_initialize() {
void rk_render_initialize(
rk_bool debug) {
GLubyte const * const vendor = glGetString(GL_VENDOR);
GLubyte const * const renderer = glGetString(GL_RENDERER);
printf("[GL] vendor: %s, renderer: %s\n", vendor, renderer);
@ -57,8 +58,10 @@ void rk_render_initialize() {
GLubyte const * const language = glGetString(GL_SHADING_LANGUAGE_VERSION);
printf("[GL] version: %s, language: %s\n", version, language);
glDebugMessageCallback(rk_debug_message_callback, nullptr);
glEnable(GL_DEBUG_OUTPUT);
if (debug) {
glDebugMessageCallback(rk_debug_message_callback, nullptr);
glEnable(GL_DEBUG_OUTPUT);
}
char const * const gl_exts = reinterpret_cast<char const *>(glGetString(GL_EXTENSIONS));
// printf("[GL] %s\n", gl_exts);