summaryrefslogtreecommitdiff
path: root/src/render/momo
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2025-05-25 18:49:20 -0400
committerAndrew Opalach <andrew@akon.city> 2025-05-25 18:49:20 -0400
commit2fa7ea95c891981684a55b41977172d040c2cc55 (patch)
treed349e810b3178045a420b625f6dbe5634b64807b /src/render/momo
parent01f852081b1291da7fc342976bf5228ffb618736 (diff)
downloadcamu-2fa7ea95c891981684a55b41977172d040c2cc55.tar.gz
camu-2fa7ea95c891981684a55b41977172d040c2cc55.tar.bz2
camu-2fa7ea95c891981684a55b41977172d040c2cc55.zip
Support Windows XP (Old FFmpeg and build fixes)
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/render/momo')
-rw-r--r--src/render/momo/meson.build12
-rw-r--r--src/render/momo/momo.c35
-rw-r--r--src/render/momo/momo.h25
3 files changed, 72 insertions, 0 deletions
diff --git a/src/render/momo/meson.build b/src/render/momo/meson.build
new file mode 100644
index 0000000..092293a
--- /dev/null
+++ b/src/render/momo/meson.build
@@ -0,0 +1,12 @@
+momo_src = ['momo.c']
+momo_deps = []
+momo_args = []
+
+libm = compiler.find_library('m', required: false)
+if libm.found()
+ momo_deps += [libm]
+endif
+linmath_h = subproject('linmath.h').get_variable('linmath_h')
+momo_deps += [linmath_h]
+
+momo = declare_dependency(sources: momo_src, dependencies: momo_deps, compile_args: momo_args)
diff --git a/src/render/momo/momo.c b/src/render/momo/momo.c
new file mode 100644
index 0000000..5239efd
--- /dev/null
+++ b/src/render/momo/momo.c
@@ -0,0 +1,35 @@
+#define AL_LOG_SECTION "momo"
+#include <al/log.h>
+
+#include "momo.h"
+
+bool MOMO_Init(MOMO_Renderer *mmr,
+#ifdef STELA_API_OPENGL
+ bool (*MakeCurrent)(void *),
+ void (*ReleaseCurrent)(void *),
+ void (*SwapBuffers)(void *),
+#endif
+ void *Private)
+{
+ mmr->Private = Private;
+#ifdef STELA_API_OPENGL
+ mmr->GL.MakeCurrent = MakeCurrent;
+ mmr->GL.ReleaseCurrent = ReleaseCurrent;
+ mmr->GL.SwapBuffers = SwapBuffers;
+ mmr->GL.MakeCurrent(mmr->Private);
+ const char *gl_version = (const char *)glGetString(GL_VERSION);
+ if (gl_version) {
+ log_info("GL context version: %s.", gl_version);
+ } else {
+ log_warn("Somehow failed to retrive GL_VERSION.");
+ }
+#endif
+ return true;
+}
+
+void MOMO_Render(MOMO_Renderer *mmr)
+{
+#ifdef STELA_API_OPENGL
+ mmr->GL.SwapBuffers(mmr->Private);
+#endif
+}
diff --git a/src/render/momo/momo.h b/src/render/momo/momo.h
new file mode 100644
index 0000000..76686ba
--- /dev/null
+++ b/src/render/momo/momo.h
@@ -0,0 +1,25 @@
+#pragma once
+
+#include <al/types.h>
+
+#ifdef STELA_API_OPENGL
+#include <stl/gl.h>
+#endif
+
+typedef struct {
+ struct {
+ bool (*MakeCurrent)(void *);
+ void (*ReleaseCurrent)(void *);
+ void (*SwapBuffers)(void *);
+ } GL;
+ void *Private;
+} MOMO_Renderer;
+
+bool MOMO_Init(MOMO_Renderer *mmr,
+#ifdef STELA_API_OPENGL
+ bool (*MakeCurrent)(void *),
+ void (*ReleaseCurrent)(void *),
+ void (*SwapBuffers)(void *),
+#endif
+ void *Private);
+void MOMO_Render(MOMO_Renderer *mmr);