Files
gio/gpu/headless/headless_ios.m
T
Elias Naur 2059862416 all: merge .m files with their .go counterparts
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>
2021-08-08 13:46:16 +01:00

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];
}