Add a parameter to enable/disable debug output.
This commit is contained in:
		@ -279,6 +279,9 @@ INSTANCE_FLAG_VISIBLE = _flag(1)
 | 
				
			|||||||
BATCH_MAX_SIZE = 65536
 | 
					BATCH_MAX_SIZE = 65536
 | 
				
			||||||
 | 
					
 | 
				
			||||||
render_initialize = _engine.rk_render_initialize
 | 
					render_initialize = _engine.rk_render_initialize
 | 
				
			||||||
 | 
					render_initialize.argtypes = (
 | 
				
			||||||
 | 
					    ctypes.c_bool,) # debug
 | 
				
			||||||
 | 
					
 | 
				
			||||||
render_terminate = _engine.rk_render_terminate
 | 
					render_terminate = _engine.rk_render_terminate
 | 
				
			||||||
 | 
					
 | 
				
			||||||
_load_shader = _engine.rk_load_shader
 | 
					_load_shader = _engine.rk_load_shader
 | 
				
			||||||
 | 
				
			|||||||
@ -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();
 | 
					RK_EXPORT void rk_render_terminate();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -49,7 +49,8 @@ static void rk_debug_message_callback(
 | 
				
			|||||||
    printf("[GL] (id=%d) %s\n", id, message);
 | 
					    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 vendor = glGetString(GL_VENDOR);
 | 
				
			||||||
    GLubyte const * const renderer = glGetString(GL_RENDERER);
 | 
					    GLubyte const * const renderer = glGetString(GL_RENDERER);
 | 
				
			||||||
    printf("[GL] vendor: %s, renderer: %s\n", vendor, 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);
 | 
					    GLubyte const * const language = glGetString(GL_SHADING_LANGUAGE_VERSION);
 | 
				
			||||||
    printf("[GL] version: %s, language: %s\n", version, language);
 | 
					    printf("[GL] version: %s, language: %s\n", version, language);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (debug) {
 | 
				
			||||||
        glDebugMessageCallback(rk_debug_message_callback, nullptr);
 | 
					        glDebugMessageCallback(rk_debug_message_callback, nullptr);
 | 
				
			||||||
        glEnable(GL_DEBUG_OUTPUT);
 | 
					        glEnable(GL_DEBUG_OUTPUT);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    char const * const gl_exts = reinterpret_cast<char const *>(glGetString(GL_EXTENSIONS));
 | 
					    char const * const gl_exts = reinterpret_cast<char const *>(glGetString(GL_EXTENSIONS));
 | 
				
			||||||
    // printf("[GL] %s\n", gl_exts);
 | 
					    // printf("[GL] %s\n", gl_exts);
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user