X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fandroid%2Ffg_window_android.c;fp=src%2Fandroid%2Ffg_window_android.c;h=bbd17fd3a6b125c89ee76187374bcb3f96039edf;hb=d1cccef518bc222b3733706aa1e5776c6cb9fec9;hp=8b1f682952f1e8d96840e2eac340a5b753da5b8a;hpb=e194bd1249867a1119e9e3f37e4e1a9886e956bc;p=freeglut diff --git a/src/android/fg_window_android.c b/src/android/fg_window_android.c index 8b1f682..bbd17fd 100644 --- a/src/android/fg_window_android.c +++ b/src/android/fg_window_android.c @@ -29,7 +29,7 @@ #define FREEGLUT_BUILDING_LIB #include #include "fg_internal.h" -extern EGLSurface fghEGLPlatformOpenWindow( EGLNativeWindowType handle ); +#include "egl/fg_window_egl.h" /* * Opens a window. Requires a SFG_Window object created and attached @@ -52,6 +52,8 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, return; } + fghCreateNewContextEGL(window); + /* Wait until window is available and OpenGL context is created */ /* Normally events are processed through glutMainLoop(), but the user didn't call it yet, and the Android may not have initialized @@ -64,14 +66,23 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, fgPlatformProcessSingleEvent(); } - EGLDisplay display = fgDisplay.pDisplay.eglDisplay; - EGLint format = fgDisplay.pDisplay.eglContextFormat; + EGLDisplay display = fgDisplay.pDisplay.egl.Display; + EGLint format = fgDisplay.pDisplay.single_window->Window.pContext.egl.ContextFormat; ANativeWindow_setBuffersGeometry(window->Window.Handle, 0, 0, format); - window->Window.pContext.eglSurface = fghEGLPlatformOpenWindow(window->Window.Handle); + fghPlatformOpenWindowEGL(window); window->State.Visible = GL_TRUE; } +/* + * Closes a window, destroying the frame and OpenGL context + */ +void fgPlatformCloseWindow( SFG_Window* window ) +{ + fghPlatformCloseWindowEGL(window); + /* Window pre-created by Android, no way to delete it */ +} + void fgPlatformSetWindow ( SFG_Window *window ) { /* TODO: only a single window possible? */