32 #include <GL/glew.h> |
32 #include <GL/glew.h> |
33 #include <cx/array_list.h> |
33 #include <cx/array_list.h> |
34 |
34 |
35 static void asc_gl_debug_callback( |
35 static void asc_gl_debug_callback( |
36 GLenum source, GLenum type, GLuint id, GLenum severity, |
36 GLenum source, GLenum type, GLuint id, GLenum severity, |
37 GLsizei length, const GLchar* message, |
37 GLsizei length, const GLchar *message, |
38 __attribute__((__unused__)) const void* userParam |
38 __attribute__((__unused__)) const void *userParam |
39 ) { |
39 ) { |
40 if (type == GL_DEBUG_TYPE_ERROR) { |
40 if (type == GL_DEBUG_TYPE_ERROR) { |
41 asc_error("OpenGL source = %d, id = %u, type = %d, severity= %d, message = %.*s", |
41 asc_error("OpenGL source = %d, id = %u, type = %d, severity= %d, message = %.*s", |
42 source, id, type, severity, length, message); |
42 source, id, type, severity, length, message); |
43 } else { |
43 } else { |
72 } |
72 } |
73 |
73 |
74 bool asc_gl_context_initialize( |
74 bool asc_gl_context_initialize( |
75 AscGLContext *ctx, |
75 AscGLContext *ctx, |
76 SDL_Window *window, |
76 SDL_Window *window, |
77 AscGLContextSettings const *settings |
77 const AscGLContextSettings *settings |
78 ) { |
78 ) { |
79 SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); |
79 SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); |
80 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, settings->gl_major_version); |
80 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, settings->gl_major_version); |
81 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, settings->gl_minor_version); |
81 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, settings->gl_minor_version); |
82 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, settings->depth_size); |
82 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, settings->depth_size); |