mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 15:45:38 +00:00
2059862416
The only reason for separate files is Objective-C callbacks into Go, or when the Go side is common, yet the Objective-C side differs from macOS to iOS. Signed-off-by: Elias Naur <mail@eliasnaur.com>
26 lines
598 B
Objective-C
26 lines
598 B
Objective-C
// SPDX-License-Identifier: Unlicense OR MIT
|
|
|
|
// +build darwin,ios
|
|
|
|
@import OpenGLES;
|
|
|
|
#include <CoreFoundation/CoreFoundation.h>
|
|
#include "_cgo_export.h"
|
|
|
|
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];
|
|
}
|