app/headless: implement headless windows

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-11-28 12:34:45 +01:00
parent 9df3c76aa2
commit 0b84137f40
10 changed files with 367 additions and 1 deletions
+29
View File
@@ -0,0 +1,29 @@
// 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];
}