egl cmp
This commit is contained in:
1 parent
b9b7e91bcd
commit
360be210c2
7 files changed
+33
-33
No files matched your search
@@ -1,27 +1,27 @@
|
||||
#ifndef RAYBRI_EGL_H
|
||||
#define RAYBRI_EGL_H
|
||||
#ifndef EGL_H
|
||||
#define EGL_H
|
||||
|
||||
#include "eglConst.h"
|
||||
#include <libEGL/libEGL.h>
|
||||
#include <libGLESv2/GLES/gl.h>
|
||||
#include "raybriEGLConst.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct RaybriEGLState {
|
||||
typedef struct EGLState {
|
||||
void *caLayer;
|
||||
EGLConfig cfg;
|
||||
EGLContext ctx;
|
||||
EGLDisplay display;
|
||||
EGLSurface surface;
|
||||
} RaybriEGLState;
|
||||
} EGLState;
|
||||
|
||||
bool raybriEGLInit(RaybriEGLState *st);
|
||||
bool raybriEGLResetSurface(RaybriEGLState *st);
|
||||
bool eglInit(EGLState *st);
|
||||
bool eglResetSurface(EGLState *st);
|
||||
|
||||
// Source
|
||||
|
||||
#if defined(RAYBRI_EGL_IMPLEMENTATION)
|
||||
#if defined(EGL_IMPLEMENTATION)
|
||||
|
||||
bool raybriEGLInit(RaybriEGLState *st) {
|
||||
bool eglInit(EGLState *st) {
|
||||
st->display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||
if (st->display == EGL_NO_DISPLAY) {
|
||||
return false;
|
||||
@@ -37,13 +37,13 @@ bool raybriEGLInit(RaybriEGLState *st) {
|
||||
|
||||
EGLint cfgCount = 0;
|
||||
if (
|
||||
eglChooseConfig(st->display, RAYBRI_EGL_CFG, &st->cfg, 1, &cfgCount) == EGL_FALSE ||
|
||||
eglChooseConfig(st->display, EGL_CFG, &st->cfg, 1, &cfgCount) == EGL_FALSE ||
|
||||
cfgCount < 1
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
st->ctx = eglCreateContext(st->display, st->cfg, EGL_NO_CONTEXT, RAYBRI_EGL_CTX);
|
||||
st->ctx = eglCreateContext(st->display, st->cfg, EGL_NO_CONTEXT, EGL_CTX);
|
||||
if (st->ctx == EGL_NO_CONTEXT) {
|
||||
return false;
|
||||
}
|
||||
@@ -51,7 +51,7 @@ bool raybriEGLInit(RaybriEGLState *st) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool raybriEGLResetSurface(RaybriEGLState *st) {
|
||||
bool eglResetSurface(EGLState *st) {
|
||||
// Destroy previous surface
|
||||
if (st->surface != EGL_NO_SURFACE) {
|
||||
eglDestroySurface(st->display, st->surface);
|
||||
@@ -73,6 +73,6 @@ bool raybriEGLResetSurface(RaybriEGLState *st) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // RAYBRI_EGL_IMPLEMENTATION
|
||||
#endif // EGL_IMPLEMENTATION
|
||||
|
||||
#endif // RAYBRI_EGL_H
|
||||
#endif // EGL_H
|
||||
@@ -1,16 +1,18 @@
|
||||
#ifndef RAYBRI_EGL_CONST_H
|
||||
#define RAYBRI_EGL_CONST_H
|
||||
#ifndef EGL_CONST_H
|
||||
#define EGL_CONST_H
|
||||
|
||||
#include <libEGL/libEGL.h>
|
||||
|
||||
// Header
|
||||
|
||||
extern const EGLint RAYBRI_EGL_CFG[];
|
||||
extern const EGLint RAYBRI_EGL_CTX[];
|
||||
extern const EGLint EGL_CFG[];
|
||||
extern const EGLint EGL_CTX[];
|
||||
|
||||
// Source
|
||||
|
||||
const EGLint RAYBRI_EGL_CFG[] = {
|
||||
#if defined(EGL_CONST_IMPLEMENTATION)
|
||||
|
||||
const EGLint EGL_CFG[] = {
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT,
|
||||
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
||||
EGL_RED_SIZE, 8,
|
||||
@@ -21,13 +23,11 @@ const EGLint RAYBRI_EGL_CFG[] = {
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
const EGLint RAYBRI_EGL_CTX[] = {
|
||||
const EGLint EGL_CTX[] = {
|
||||
EGL_CONTEXT_CLIENT_VERSION, 3,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
#if defined(RAYBRI_EGL_CONST_IMPLEMENTATION)
|
||||
#endif // EGL_CONST_IMPLEMENTATION
|
||||
|
||||
#endif // RAYBRI_EGL_CONST_IMPLEMENTATION
|
||||
|
||||
#endif // RAYBRI_EGL_CONST_H
|
||||
#endif // EGL_CONST_H
|
||||
@@ -1,17 +1,17 @@
|
||||
#include "raybri.h"
|
||||
|
||||
#define RAYBRI_EGL_CONST_IMPLEMENTATION
|
||||
#include "raybriEGLConst.h"
|
||||
#define EGL_CONST_IMPLEMENTATION
|
||||
#include "eglConst.h"
|
||||
|
||||
#define RAYBRI_EGL_IMPLEMENTATION
|
||||
#include "raybriEGL.h"
|
||||
#define EGL_IMPLEMENTATION
|
||||
#include "egl.h"
|
||||
|
||||
#define RLGL_IMPLEMENTATION
|
||||
#include "rlgl.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static RaybriEGLState globalES = {
|
||||
static EGLState globalES = {
|
||||
.caLayer = NULL,
|
||||
.cfg = NULL,
|
||||
.ctx = EGL_NO_CONTEXT,
|
||||
@@ -24,10 +24,10 @@ void raybriInit(void *layer) {
|
||||
|
||||
globalES.caLayer = layer;
|
||||
|
||||
if (!raybriEGLInit(&globalES)) {
|
||||
if (!eglInit(&globalES)) {
|
||||
raybriLog("ERROR Could not initialize EGL");
|
||||
}
|
||||
if (!raybriEGLResetSurface(&globalES)) {
|
||||
if (!eglResetSurface(&globalES)) {
|
||||
raybriLog("ERROR Could not reset EGL surface");
|
||||
}
|
||||
|
||||
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../../../components/egl/egl.h
|
||||
+1
@@ -0,0 +1 @@
|
||||
../../../../components/egl/eglConst.h
|
||||
@@ -1 +0,0 @@
|
||||
../../../../components/raybri/ios/raybriEGL.h
|
||||
@@ -1 +0,0 @@
|
||||
../../../../components/raybri/ios/raybriEGLConst.h
|
||||
Reference in new issue
Block a user