#if defined(_GLES)
#define ES1_1
#else
-// #define SHADERS
+ #define SHADERS
#endif
#define GL_BGRA_EXT 0x80E1
# endif
#endif
+#if defined(__ANDROID__) || defined(__ODROID__)
+import "egl"
+#endif
+
import "glab"
import "immediate"
import "matrixStack"
#include <GL/gl.h>
//#include <GLES/gl.h>
- //#include <EGL/egl.h>
-
//#include <GLES2/gl.h>
- //#include <EGL/egl.h>
-
- //#include <GLES2/gl2.h>
#include <GL/glfw.h>
#include <emscripten/emscripten.h>
}
#elif defined(__unix__) || defined(__APPLE__)
vboAvailable = true;
- #if defined(__ANDROID__)
+ #if defined(__ANDROID__) || defined(__ODROID__)
+ #if defined(__ANDROID__)
egl_init_display(guiApp.desktop.windowHandle);
- #elif defined(__ODROID__)
+ #elif defined(__ODROID__)
egl_init_display((uint)displaySystem.window);
CheckExtensions(oglSystem);
+ #endif
+
+ // TODO: Clean this up? Needed here?
+ 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,eglWidth,eglHeight);
+ glmsLoadIdentity();
+ glOrtho(0,eglWidth,eglHeight,0,0.0,1.0);
+
+ glabCurArrayBuffer = 0;
+ glabCurElementBuffer = 0;
+
result = true;
#elif defined(__EMSCRIPTEN__)
if(glfwInit() == GL_TRUE)
void DestroyDisplaySystem(DisplaySystem displaySystem)
{
OGLSystem oglSystem = displaySystem.driverData;
+ if(stippleTexture)
+ {
+ glDeleteTextures(1, &stippleTexture);
+ stippleTexture = 0;
+ }
#if defined(__WIN32__)
wglMakeCurrent( null, null );
#endif
if(result)
{
+#if !defined(__ANDROID__) && !defined(__EMSCRIPTEN__) && !defined(__ODROID__)
ogl_LoadFunctions();
CheckExtensions(oglSystem);
vboAvailable = glBindBuffer != null;
setupDebugging();
+#endif
#ifdef SHADERS
loadShaders("<:ecere>shaders/fixed.vertex", "<:ecere>shaders/fixed.frag");
#endif
SwapBuffers(oglDisplay.hdc);
#elif defined(__unix__) || defined(__APPLE__)
#if defined(__ANDROID__) || defined(__ODROID__)
- eglSwapBuffers(eglDisplay, eglSurface);
+ egl_swap_buffers();
#elif defined(__EMSCRIPTEN__)
glfwSwapBuffers();
#else