X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fandroid%2Ffg_window_android.c;h=af2d6912a6d088a311f85c19f77e296b05a88209;hb=207c3128bf025b5e025bace5c0425d380dd72aa9;hp=65f4d4d738d1f45539f39bf46f871d48fe245caf;hpb=b08e8e8fbedd2df556da4897b1473ac26270cb48;p=freeglut diff --git a/src/android/fg_window_android.c b/src/android/fg_window_android.c index 65f4d4d..af2d691 100644 --- a/src/android/fg_window_android.c +++ b/src/android/fg_window_android.c @@ -32,8 +32,6 @@ #include "egl/fg_window_egl.h" #include -extern void fghRedrawWindow(SFG_Window *window); - /* * Opens a window. Requires a SFG_Window object created and attached * to the freeglut structure. OpenGL context is created here. @@ -66,6 +64,7 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, /* fgPlatformProcessSingleEvent(); */ } window->Window.Handle = fgDisplay.pDisplay.single_native_window; + window->State.WorkMask |= GLUT_INIT_WORK; /* Create context */ fghChooseConfig(&window->Window.pContext.egl.Config); @@ -84,6 +83,14 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, fghPlatformOpenWindowEGL(window); + /* Bind context to the current thread if it's lost */ + if (eglGetCurrentContext() == EGL_NO_CONTEXT && + eglMakeCurrent(fgDisplay.pDisplay.egl.Display, + window->Window.pContext.egl.Surface, + window->Window.pContext.egl.Surface, + window->Window.Context) == EGL_FALSE) + fgError("eglMakeCurrent: err=%x\n", eglGetError()); + window->State.Visible = GL_TRUE; } @@ -96,14 +103,6 @@ void fgPlatformReshapeWindow ( SFG_Window *window, int width, int height ) } /* - * A static helper function to execute display callback for a window - */ -void fgPlatformDisplayWindow ( SFG_Window *window ) -{ - fghRedrawWindow ( window ) ; -} - -/* * Closes a window, destroying the frame and OpenGL context */ void fgPlatformCloseWindow( SFG_Window* window ) @@ -113,25 +112,25 @@ void fgPlatformCloseWindow( SFG_Window* window ) } /* - * This function makes the current window visible + * This function makes the specified window visible */ -void fgPlatformGlutShowWindow( void ) +void fgPlatformShowWindow( void ) { - fprintf(stderr, "fgPlatformGlutShowWindow: STUB\n"); + fprintf(stderr, "fgPlatformShowWindow: STUB\n"); } /* - * This function hides the current window + * This function hides the specified window */ -void fgPlatformGlutHideWindow( void ) +void fgPlatformHideWindow( SFG_Window *window ) { - fprintf(stderr, "fgPlatformGlutHideWindow: STUB\n"); + fprintf(stderr, "fgPlatformHideWindow: STUB\n"); } /* - * Iconify the current window (top-level windows only) + * Iconify the specified window (top-level windows only) */ -void fgPlatformGlutIconifyWindow( void ) +void fgPlatformIconifyWindow( SFG_Window *window ) { fprintf(stderr, "fgPlatformGlutIconifyWindow: STUB\n"); } @@ -152,49 +151,33 @@ void fgPlatformGlutSetIconTitle( const char* title ) fprintf(stderr, "fgPlatformGlutSetIconTitle: STUB\n");} /* - * Change the current window's position - */ -void fgPlatformGlutPositionWindow( int x, int y ) -{ - fprintf(stderr, "fgPlatformGlutPositionWindow: STUB\n"); -} - -/* - * Lowers the current window (by Z order change) - */ -void fgPlatformGlutPushWindow( void ) -{ - fprintf(stderr, "fgPlatformGlutPushWindow: STUB\n"); -} - -/* - * Raises the current window (by Z order change) + * Change the specified window's position */ -void fgPlatformGlutPopWindow( void ) +void fgPlatformPositionWindow( SFG_Window *window, int x, int y ) { - fprintf(stderr, "fgPlatformGlutPopWindow: STUB\n"); + fprintf(stderr, "fgPlatformPositionWindow: STUB\n"); } /* - * Resize the current window so that it fits the whole screen + * Lowers the specified window (by Z order change) */ -void fgPlatformGlutFullScreen( SFG_Window *win ) +void fgPlatformPushWindow( SFG_Window *window ) { - fprintf(stderr, "fgPlatformGlutFullScreen: STUB\n"); + fprintf(stderr, "fgPlatformPushWindow: STUB\n"); } /* - * If we are fullscreen, resize the current window back to its original size + * Raises the specified window (by Z order change) */ -void fgPlatformGlutLeaveFullScreen( SFG_Window *win ) +void fgPlatformPopWindow( SFG_Window *window ) { - fprintf(stderr, "fgPlatformGlutLeaveFullScreen: STUB\n"); + fprintf(stderr, "fgPlatformPopWindow: STUB\n"); } /* * Toggle the window's full screen state. */ -void fgPlatformGlutFullScreenToggle( SFG_Window *win ) +void fgPlatformFullScreenToggle( SFG_Window *win ) { - fprintf(stderr, "fgPlatformGlutFullScreenToggle: STUB\n"); + fprintf(stderr, "fgPlatformFullScreenToggle: STUB\n"); }