src/video/android/SDL_androidgl.c
author Paul Hunkin <paul@bieh.net>
Mon, 28 Jun 2010 21:35:28 +1200
changeset 4710 aeac51289991
parent 4709 6dc26b9d8368
child 4711 ed040b480a9f
permissions -rw-r--r--
Last test version with GLSurface
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997-2010 Sam Lantinga
     4 
     5     This library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Lesser General Public
     7     License as published by the Free Software Foundation; either
     8     version 2.1 of the License, or (at your option) any later version.
     9 
    10     This library is distributed in the hope that it will be useful,
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13     Lesser General Public License for more details.
    14 
    15     You should have received a copy of the GNU Lesser General Public
    16     License along with this library; if not, write to the Free Software
    17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    18 
    19     Sam Lantinga
    20     slouken@libsdl.org
    21 */
    22 #include "SDL_config.h"
    23 
    24 /* Android SDL video driver implementation
    25 */
    26 
    27 #include "SDL_video.h"
    28 #include "SDL_mouse.h"
    29 #include "../SDL_sysvideo.h"
    30 #include "../SDL_pixels_c.h"
    31 #include "../../events/SDL_events_c.h"
    32 
    33 #include "SDL_androidvideo.h"
    34 #include "SDL_androidevents.h"
    35 #include "SDL_androidrender.h"
    36 
    37 #include <android/log.h>
    38 
    39 #include <pthread.h>
    40 
    41 /*
    42 These things are in the JNI android support
    43 */
    44 extern pthread_mutex_t mSDLRenderMutex;
    45 extern pthread_cond_t mSDLRenderCondition;
    46 extern void sdl_render();
    47 
    48 /* GL functions */
    49 int Android_GL_LoadLibrary(_THIS, const char *path){
    50 	__android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_LoadLibrary\n");
    51 	return 0;
    52 }
    53 
    54 void *Android_GL_GetProcAddress(_THIS, const char *proc){
    55 	__android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_GetProcAddress\n");
    56 	return 0;
    57 }
    58 
    59 void Android_GL_UnloadLibrary(_THIS){
    60 	__android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_UnloadLibrary\n");
    61 }
    62 
    63 /*
    64 int *Android_GL_GetVisual(_THIS, Display * display, int screen){
    65 	__android_log_print(ANDROID_LOG_INFO, "SDL","[STUB] GL_GetVisual\n");
    66 	return 0;
    67 }
    68 */
    69 
    70 SDL_GLContext Android_GL_CreateContext(_THIS, SDL_Window * window){
    71 	__android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_CreateContext\n");
    72 	return 1;
    73 }
    74 
    75 int Android_GL_MakeCurrent(_THIS, SDL_Window * window,
    76                               SDL_GLContext context){
    77 	__android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_MakeCurrent\n");
    78 	return 0;
    79 }
    80 
    81 int Android_GL_SetSwapInterval(_THIS, int interval){
    82 	__android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_SetSwapInterval\n");
    83 	return 0;
    84 }
    85 
    86 int Android_GL_GetSwapInterval(_THIS){
    87 	__android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_GetSwapInterval\n");
    88 	return 0;
    89 }
    90 
    91 void Android_GL_SwapWindow(_THIS, SDL_Window * window){
    92 
    93 /*
    94 	pthread_mutex_lock(&mSDLRenderMutex);
    95 	pthread_cond_wait(&mSDLRenderCondition, &mSDLRenderMutex);
    96 	pthread_mutex_unlock(&mSDLRenderMutex);
    97 */	
    98 	
    99 	//__android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_SwapWindow\n");
   100 	sdl_render();
   101 
   102 }
   103 
   104 void Android_GL_DeleteContext(_THIS, SDL_GLContext context){
   105 	__android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_DeleteContext\n");
   106 }