From 1f93c3ef62af6c71217f06491ca2b859d4065740 Mon Sep 17 00:00:00 2001 From: pryazha Date: Sat, 16 Aug 2025 10:11:00 +0500 Subject: in practice chapter --- in_practice/breakout/gl_utils.c | 75 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 in_practice/breakout/gl_utils.c (limited to 'in_practice/breakout/gl_utils.c') diff --git a/in_practice/breakout/gl_utils.c b/in_practice/breakout/gl_utils.c new file mode 100644 index 0000000..fc1e3af --- /dev/null +++ b/in_practice/breakout/gl_utils.c @@ -0,0 +1,75 @@ +#include "gl_utils.h" +#include "sys.h" + +extern void gl_debug_output(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const void *user_param) +{ + /* ignore these non-significant error codes */ + if(id == 131169 || id == 131185 || id == 131218 || id == 131204) + return; + if (user_param) + info("user parameters doesn't supported"); + info("debug message (%d length: %d): %s", id, length, message); + switch (source) { + case GL_DEBUG_SOURCE_API: + info("source: api"); + break; + case GL_DEBUG_SOURCE_WINDOW_SYSTEM: + info("source: window system"); + break; + case GL_DEBUG_SOURCE_SHADER_COMPILER: + info("source: shader compiler"); + break; + case GL_DEBUG_SOURCE_THIRD_PARTY: + info("source: third party"); + break; + case GL_DEBUG_SOURCE_APPLICATION: + info("source: application"); + break; + case GL_DEBUG_SOURCE_OTHER: + info("source: other"); + break; + } + switch (type) { + case GL_DEBUG_TYPE_ERROR: + info("type: error"); + break; + case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: + info("type: deprecated behaviour"); + break; + case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: + info("type: undefined behaviour"); + break; + case GL_DEBUG_TYPE_PORTABILITY: + info("type: portability"); + break; + case GL_DEBUG_TYPE_PERFORMANCE: + info("type: performance"); + break; + case GL_DEBUG_TYPE_MARKER: + info("type: marker"); + break; + case GL_DEBUG_TYPE_PUSH_GROUP: + info("type: push group"); + break; + case GL_DEBUG_TYPE_POP_GROUP: + info("type: pop group"); + break; + case GL_DEBUG_TYPE_OTHER: + info("type: other"); + break; + } + switch (severity) { + case GL_DEBUG_SEVERITY_HIGH: + info("severity: high"); + break; + case GL_DEBUG_SEVERITY_MEDIUM: + info("severity: medium"); + break; + case GL_DEBUG_SEVERITY_LOW: + info("severity: low"); + break; + case GL_DEBUG_SEVERITY_NOTIFICATION: + info("severity: notification"); + break; + } +} -- cgit v1.2.3-70-g09d2