src/ascension/glcontext.h

changeset 311
87ff4c57955d
parent 298
fa91e2e06eee
equal deleted inserted replaced
310:9212be32d7a2 311:87ff4c57955d
30 30
31 #include <SDL3/SDL.h> 31 #include <SDL3/SDL.h>
32 32
33 #include <cx/list.h> 33 #include <cx/list.h>
34 34
35 // TODO: we might want to get rid of this struct
36 typedef struct asc_gl_context_settings_s {
37 int gl_major_version;
38 int gl_minor_version;
39 int depth_size;
40 bool vsync;
41 bool fullscreen;
42 } AscGLContextSettings;
43
44 typedef struct asc_gl_counters_s { 35 typedef struct asc_gl_counters_s {
45 unsigned long long draw_calls; 36 unsigned long long draw_calls;
46 unsigned long long vertices_rendered; 37 unsigned long long vertices_rendered;
47 unsigned long long triangles_rendered; 38 unsigned long long triangles_rendered;
48 } AscGLCounters; 39 } AscGLCounters;
70 */ 61 */
71 AscGLCounters ctr; 62 AscGLCounters ctr;
72 unsigned active_program; 63 unsigned active_program;
73 } AscGLContext; 64 } AscGLContext;
74 65
75 AscGLContextSettings asc_gl_context_settings_default(int gl_major_version, int gl_minor_version); 66 bool asc_gl_context_initialize(AscGLContext *ctx, SDL_Window *window);
76
77 bool asc_gl_context_initialize(
78 AscGLContext *ctx,
79 SDL_Window *window,
80 const AscGLContextSettings *settings
81 );
82 67
83 void asc_gl_context_destroy(AscGLContext *ctx); 68 void asc_gl_context_destroy(AscGLContext *ctx);
84 69
85 static inline void asc_gl_context_activate(AscGLContext *ctx) { 70 static inline void asc_gl_context_activate(AscGLContext *ctx) {
86 SDL_GL_MakeCurrent(ctx->window, ctx->glctx); 71 SDL_GL_MakeCurrent(ctx->window, ctx->glctx);

mercurial