notaz.gp2x.de
/
libpicofe.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
plat: avoid MAP_FIXED
[libpicofe.git]
/
gl.c
diff --git
a/gl.c
b/gl.c
index
92b39f7
..
2ebb87c
100644
(file)
--- a/
gl.c
+++ b/
gl.c
@@
-3,12
+3,17
@@
#include <EGL/egl.h>
#include <GLES/gl.h>
#include <EGL/egl.h>
#include <GLES/gl.h>
+#include "gl_platform.h"
#include "gl.h"
static EGLDisplay edpy;
static EGLSurface esfc;
static EGLContext ectxt;
#include "gl.h"
static EGLDisplay edpy;
static EGLSurface esfc;
static EGLContext ectxt;
+/* for external flips */
+void *gl_es_display;
+void *gl_es_surface;
+
static int gl_have_error(const char *name)
{
GLenum e = glGetError();
static int gl_have_error(const char *name)
{
GLenum e = glGetError();
@@
-29,7
+34,7
@@
static int gles_have_error(const char *name)
return 0;
}
return 0;
}
-int gl_init(void *display, void *window)
+int gl_init(void *display, void *window
, int *quirks
)
{
EGLConfig ecfg = NULL;
GLuint texture_name = 0;
{
EGLConfig ecfg = NULL;
GLuint texture_name = 0;
@@
-42,6
+47,12
@@
int gl_init(void *display, void *window)
EGL_NONE
};
EGL_NONE
};
+ ret = gl_platform_init(&display, &window, quirks);
+ if (ret != 0) {
+ fprintf(stderr, "gl_platform_init failed with %d\n", ret);
+ goto out;
+ }
+
tmp_texture_mem = calloc(1, 1024 * 512 * 2);
if (tmp_texture_mem == NULL) {
fprintf(stderr, "OOM\n");
tmp_texture_mem = calloc(1, 1024 * 512 * 2);
if (tmp_texture_mem == NULL) {
fprintf(stderr, "OOM\n");
@@
-112,6
+123,8
@@
int gl_init(void *display, void *window)
if (gl_have_error("init"))
goto out;
if (gl_have_error("init"))
goto out;
+ gl_es_display = (void *)edpy;
+ gl_es_surface = (void *)esfc;
retval = 0;
out:
free(tmp_texture_mem);
retval = 0;
out:
free(tmp_texture_mem);
@@
-177,4
+190,9
@@
void gl_finish(void)
esfc = EGL_NO_SURFACE;
eglTerminate(edpy);
edpy = EGL_NO_DISPLAY;
esfc = EGL_NO_SURFACE;
eglTerminate(edpy);
edpy = EGL_NO_DISPLAY;
+
+ gl_es_display = (void *)edpy;
+ gl_es_surface = (void *)esfc;
+
+ gl_platform_finish();
}
}