/** @file Optional OpenGL/OpenGL ES contexts. Attribute lists are per-call. */ #ifndef YASL_GL_H #define YASL_GL_H #include "yasl/yasl.h" #ifdef __cplusplus extern "C" { #endif enum yasl_gl_attribute { YASL_GL_END, YASL_GL_MAJOR, YASL_GL_MINOR, YASL_GL_PROFILE, YASL_GL_DEBUG, YASL_GL_FORWARD_COMPAT, YASL_GL_RED_BITS, YASL_GL_GREEN_BITS, YASL_GL_BLUE_BITS, YASL_GL_ALPHA_BITS, YASL_GL_DEPTH_BITS, YASL_GL_STENCIL_BITS, YASL_GL_SAMPLES, YASL_GL_SRGB, YASL_GL_API }; enum yasl_gl_profile { YASL_GL_ANY, YASL_GL_CORE, YASL_GL_COMPATIBILITY }; enum yasl_gl_api { YASL_GL_OPENGL, YASL_GL_OPENGL_ES }; typedef void (*yasl_gl_proc)(void); /** key/value pairs terminated by END, NULL defaults to GL3.2 core RGBA8 D24 S8. * share is a live GL surface or NULL. CPU flag is invalid. Context is owned by * the returned surface. Detach it from all rendering threads before destruction. */ YASL_API yasl_surface *yasl_gl_surface_create(const char *title, int width, int height, unsigned flags, const int *attributes, yasl_surface *share); /** May run on a rendering thread. NULL detaches this thread's current context. */ YASL_API bool yasl_gl_make_current(yasl_surface *surface); YASL_API yasl_gl_proc yasl_gl_get_proc_address(const char *name); YASL_API bool yasl_gl_swap_interval(yasl_surface *surface, int interval); YASL_API bool yasl_gl_swap_buffers(yasl_surface *surface); #ifdef __cplusplus } #endif #endif