ecere: Fixes to build branch for Android
[sdk] / ecere / src / gfx / drivers / gl3 / egl.ec
index 2624c26..48bbb35 100644 (file)
@@ -1,5 +1,7 @@
 #if defined(__ANDROID__) || defined(__ODROID__)
 
+import "instance"
+
 #include <EGL/egl.h>
 
 EGLDisplay eglDisplay;
@@ -8,9 +10,9 @@ EGLContext eglContext;
 int eglWidth, eglHeight;
 
 #if defined(__ANDROID__)
-static bool egl_init_display(ANativeWindow* window)
+bool egl_init_display(ANativeWindow* window)
 #else
-static bool egl_init_display(uint window)
+bool egl_init_display(uint window)
 #endif
 {
    const EGLint attribs[] =
@@ -50,53 +52,11 @@ static bool egl_init_display(uint window)
    eglWidth = w;
    eglHeight = h;
 
-   glEnableClientState(GL_VERTEX_ARRAY);
-   /*
-   // Initialize GL state.
-   glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
-   glEnable(GL_CULL_FACE);
-   glShadeModel(GL_SMOOTH);
-   glDisable(GL_DEPTH_TEST);
-   */
-   glDisable(GL_CULL_FACE);
-   glDisable(GL_DEPTH_TEST);
-
-   glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-   glEnable(GL_BLEND);
-
-   matrixStack[0][0].Identity();
-   matrixStack[1][0].Identity();
-   matrixStack[2][0].Identity();
-
-   glmsMatrixMode(GL_MODELVIEW);
-   glScaled(1.0, 1.0, -1.0);
-   glmsMatrixMode(GL_PROJECTION);
-   glShadeModel(GL_FLAT);
-
-   glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
-   glFogi(GL_FOG_MODE, GL_EXP);
-   glFogf(GL_FOG_DENSITY, 0);
-   glEnable(GL_NORMALIZE);
-   glDepthFunc(GL_LESS);
-   glClearDepth(1.0);
-   glDisable(GL_MULTISAMPLE_ARB);
-
-   glViewport(0,0,w,h);
-   glmsLoadIdentity();
-   glOrtho(0,w,h,0,0.0,1.0);
-
-   glabCurArrayBuffer = 0;
-   glabCurElementBuffer = 0;
    return true;
 }
 
-static void egl_term_display()
+void egl_term_display()
 {
-   if(stippleTexture)
-   {
-      glDeleteTextures(1, &stippleTexture);
-      stippleTexture = 0;
-   }
    if(eglDisplay != EGL_NO_DISPLAY)
    {
       eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
@@ -111,4 +71,9 @@ static void egl_term_display()
    eglSurface = EGL_NO_SURFACE;
 }
 
+void egl_swap_buffers()
+{
+   eglSwapBuffers(eglDisplay, eglSurface);
+}
+
 #endif