diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-10-10 13:56:10 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-10-10 13:59:44 +0200 |
commit | 54b2376adad98d91d32378efc3f241f120ba970f (patch) | |
tree | 4556581f7c51f88e9cb1e5610bc8afef524340e1 /include | |
parent | 3b2fceed064c06d55e1cd33d51e855e909c81f75 (diff) |
Draw every frame instead of x11 expose, enable vsync (if available)
Diffstat (limited to 'include')
-rw-r--r-- | include/mgl/gl.h | 17 | ||||
-rw-r--r-- | include/mgl/glx.h | 21 | ||||
-rw-r--r-- | include/mgl/mgl.h | 2 | ||||
-rw-r--r-- | include/mgl/window.h | 3 |
4 files changed, 19 insertions, 24 deletions
diff --git a/include/mgl/gl.h b/include/mgl/gl.h index 1791059..b5b6ca1 100644 --- a/include/mgl/gl.h +++ b/include/mgl/gl.h @@ -1,11 +1,28 @@ #ifndef MGL_GL_H #define MGL_GL_H +typedef struct _XVisualInfo _XVisualInfo; +typedef struct _XDisplay Display; +typedef struct __GLXcontextRec *GLXContext; +typedef unsigned long GLXDrawable; + typedef struct { void *handle; + + _XVisualInfo* (*glXChooseVisual)(Display *dpy, int screen, int *attribList); + GLXContext (*glXCreateContext)(Display *dpy, _XVisualInfo *vis, GLXContext shareList, int direct); + void (*glXDestroyContext)(Display *dpy, GLXContext ctx); + int (*glXMakeCurrent)(Display *dpy, GLXDrawable drawable, GLXContext ctx); + void (*glXSwapBuffers)(Display *dpy, GLXDrawable drawable); + void (*glViewport)(int x, int y, int width, int height); void (*glClearColor)(float red, float green, float blue, float alpha); void (*glClear)(unsigned int mask); + + /* Optional*/ + void (*glXSwapIntervalEXT)(Display * dpy, GLXDrawable drawable, int interval); + int (*glXSwapIntervalMESA)(unsigned int interval); + int (*glXSwapIntervalSGI)(int interval); } mgl_gl; int mgl_gl_load(mgl_gl *self); diff --git a/include/mgl/glx.h b/include/mgl/glx.h deleted file mode 100644 index 4197402..0000000 --- a/include/mgl/glx.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef MGL_GLX_H -#define MGL_GLX_H - -typedef struct _XVisualInfo _XVisualInfo; -typedef struct _XDisplay Display; -typedef struct __GLXcontextRec *GLXContext; -typedef unsigned long GLXDrawable; - -typedef struct { - void *handle; - _XVisualInfo* (*glXChooseVisual)(Display *dpy, int screen, int *attribList); - GLXContext (*glXCreateContext)(Display *dpy, _XVisualInfo *vis, GLXContext shareList, int direct); - void (*glXDestroyContext)(Display *dpy, GLXContext ctx); - int (*glXMakeCurrent)(Display *dpy, GLXDrawable drawable, GLXContext ctx); - void (*glXSwapBuffers)(Display *dpy, GLXDrawable drawable); -} mgl_glx; - -int mgl_glx_load(mgl_glx *self); -void mgl_glx_unload(mgl_glx *self); - -#endif /* MGL_GLX_H */ diff --git a/include/mgl/mgl.h b/include/mgl/mgl.h index 606c14b..e906bc1 100644 --- a/include/mgl/mgl.h +++ b/include/mgl/mgl.h @@ -1,7 +1,6 @@ #ifndef MGL_MGL_H #define MGL_MGL_H -#include "glx.h" #include "gl.h" /* Display* on x11 */ @@ -11,7 +10,6 @@ typedef struct { mgl_connection connection; GLXContext glx_context; _XVisualInfo *visual_info; - mgl_glx glx; mgl_gl gl; } mgl_context; diff --git a/include/mgl/window.h b/include/mgl/window.h index c6dc9e2..57e3072 100644 --- a/include/mgl/window.h +++ b/include/mgl/window.h @@ -18,6 +18,7 @@ int mgl_window_create_with_params(mgl_window *self, const char *title, int width void mgl_window_deinit(mgl_window *self); void mgl_window_show(mgl_window *self); -void mgl_window_event_poll(mgl_window *self, int timeout_ms); +void mgl_window_event_poll(mgl_window *self); +void mgl_window_draw(mgl_window *self); #endif /* MGL_WINDOW_H */ |