mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 15:45:38 +00:00
d9212263aa
The macOS backend uses a desktop OpenGL context, not a OpenGL ES context. The main difference is that sRGB have to be enabled and a vertex buffer must be bound. Do that and fix Window.Screenshot for scenes more complex than a glClear. Signed-off-by: Elias Naur <mail@eliasnaur.com>
33 lines
742 B
Objective-C
33 lines
742 B
Objective-C
// SPDX-License-Identifier: Unlicense OR MIT
|
|
|
|
// +build darwin,ios
|
|
|
|
@import OpenGLES;
|
|
|
|
#include <CoreFoundation/CoreFoundation.h>
|
|
#include "headless_darwin.h"
|
|
|
|
void gio_headless_releaseContext(CFTypeRef ctxRef) {
|
|
CFBridgingRelease(ctxRef);
|
|
}
|
|
|
|
CFTypeRef gio_headless_newContext(void) {
|
|
EAGLContext *ctx = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3];
|
|
if (ctx == nil) {
|
|
return nil;
|
|
}
|
|
return CFBridgingRetain(ctx);
|
|
}
|
|
|
|
void gio_headless_clearCurrentContext(CFTypeRef ctxRef) {
|
|
[EAGLContext setCurrentContext:nil];
|
|
}
|
|
|
|
void gio_headless_makeCurrentContext(CFTypeRef ctxRef) {
|
|
EAGLContext *ctx = (__bridge EAGLContext *)ctxRef;
|
|
[EAGLContext setCurrentContext:ctx];
|
|
}
|
|
|
|
void gio_headless_prepareContext(CFTypeRef ctxRef) {
|
|
}
|