raybri mac

This commit is contained in:
Михаил Капелько committed 2026-10-27 06:39:07 +03:00
1 parent 1c841a18bb
commit 21605f98b4
5 files changed

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
#include "raybri.h"
#include "raybriAux.h"
#include "rlgl.h"
void raybriInit(void) {
//SetTraceLogLevel(LOG_WARNING);
// Load OpenGL extensions
rlLoadExtensions((void *)raybriGLLoader);
// Initialize raylib graphics layer with a placeholder 1x1 framebuffer size
// Graphics layer includes default texture, shader, render batch and OpenGL state
rlglInit(1, 1);
// Background is painted in blue
rlClearColor(0, 0, 255, 255);
}
void raybriRender(int width, int height) {
// Set the drawing area to the current pixel size
rlViewport(0, 0, width, height);
// Clear color and depth buffers for the next frame
rlClearScreenBuffers();
// Draw any queued geometry
rlDrawRenderBatchActive();
}
void raybriShutdown(void) {
// Release rlgl buffers, shaders and textures
rlglClose();
}
+21
View File
@@ -0,0 +1,21 @@
#include <dlfcn.h>
#include "raybriAux.h"
#include "raybriConst.h"
#include <stddef.h>
// raylib is built as a static/dynamic library with GLFW baked in, but we never
// call InitWindow(). Instead we render into an OpenGL context owned by the
// macOS app, so we must supply the OpenGL entry point loader ourselves.
void *raybriGLLoader(const char *name) {
static void *handle = NULL;
if (handle == NULL) {
handle = dlopen(RAYBRI_MAC_GL, RTLD_LAZY | RTLD_LOCAL);
}
if (handle == NULL) {
return NULL;
}
return dlsym(handle, name);
}
+6
View File
@@ -0,0 +1,6 @@
#ifndef RAYBRI_AUX_H
#define RAYBRI_AUX_H
void *raybriGLLoader(const char *name);
#endif // RAYBRI_AUX_H
+3
View File
@@ -0,0 +1,3 @@
#include "raybriConst.h"
const char RAYBRI_MAC_GL[] = "/System/Library/Frameworks/OpenGL.framework/OpenGL";
+6
View File
@@ -0,0 +1,6 @@
#ifndef RAYBRI_CONST_H
#define RAYBRI_CONST_H
extern const char RAYBRI_MAC_GL[];
#endif // RAYBRI_CONST_H