src/video/pandora/SDL_pandora.c
changeset 10207 e66f6ab2b059
parent 10205 baabe483bb99
child 10208 49c460371a4a
equal deleted inserted replaced
10206:30ca8e64db6a 10207:e66f6ab2b059
    39 #include "GLES/gl.h"
    39 #include "GLES/gl.h"
    40 #ifdef WIZ_GLES_LITE
    40 #ifdef WIZ_GLES_LITE
    41 static NativeWindowType hNativeWnd = 0; /* A handle to the window we will create. */
    41 static NativeWindowType hNativeWnd = 0; /* A handle to the window we will create. */
    42 #endif
    42 #endif
    43 
    43 
    44 static SDL_bool PND_initialized = SDL_FALSE;
       
    45 
       
    46 static int
    44 static int
    47 PND_available(void)
    45 PND_available(void)
    48 {
    46 {
    49     return 1;
    47     return 1;
    50 }
    48 }
    51 
    49 
    52 static void
    50 static void
    53 PND_destroy(SDL_VideoDevice * device)
    51 PND_destroy(SDL_VideoDevice * device)
    54 {
    52 {
    55     SDL_VideoData *phdata = (SDL_VideoData *) device->driverdata;
       
    56 
       
    57     if (device->driverdata != NULL) {
    53     if (device->driverdata != NULL) {
    58         device->driverdata = NULL;
    54         device->driverdata = NULL;
    59     }
    55     }
    60 }
    56 }
    61 
    57 
   201 {
   197 {
   202     SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
   198     SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
   203 
   199 
   204     SDL_WindowData *wdata;
   200     SDL_WindowData *wdata;
   205 
   201 
   206     uint32_t winargc = 0;
       
   207     int32_t status;
       
   208 
       
   209 
       
   210     /* Allocate window internal data */
   202     /* Allocate window internal data */
   211     wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData));
   203     wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData));
   212     if (wdata == NULL) {
   204     if (wdata == NULL) {
   213         return SDL_OutOfMemory();
   205         return SDL_OutOfMemory();
   214     }
   206     }
   289 void
   281 void
   290 PND_restorewindow(_THIS, SDL_Window * window)
   282 PND_restorewindow(_THIS, SDL_Window * window)
   291 {
   283 {
   292 }
   284 }
   293 void
   285 void
   294 PND_setwindowgrab(_THIS, SDL_Window * window)
   286 PND_setwindowgrab(_THIS, SDL_Window * window, SDL_bool grabbed)
   295 {
   287 {
   296 }
   288 }
   297 void
   289 void
   298 PND_destroywindow(_THIS, SDL_Window * window)
   290 PND_destroywindow(_THIS, SDL_Window * window)
   299 {
   291 {
   323 /* SDL OpenGL/OpenGL ES functions                                            */
   315 /* SDL OpenGL/OpenGL ES functions                                            */
   324 /*****************************************************************************/
   316 /*****************************************************************************/
   325 int
   317 int
   326 PND_gl_loadlibrary(_THIS, const char *path)
   318 PND_gl_loadlibrary(_THIS, const char *path)
   327 {
   319 {
   328     SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
       
   329 
       
   330     /* Check if OpenGL ES library is specified for GF driver */
   320     /* Check if OpenGL ES library is specified for GF driver */
   331     if (path == NULL) {
   321     if (path == NULL) {
   332         path = SDL_getenv("SDL_OPENGL_LIBRARY");
   322         path = SDL_getenv("SDL_OPENGL_LIBRARY");
   333         if (path == NULL) {
   323         if (path == NULL) {
   334             path = SDL_getenv("SDL_OPENGLES_LIBRARY");
   324             path = SDL_getenv("SDL_OPENGLES_LIBRARY");
   362 }
   352 }
   363 
   353 
   364 void *
   354 void *
   365 PND_gl_getprocaddres(_THIS, const char *proc)
   355 PND_gl_getprocaddres(_THIS, const char *proc)
   366 {
   356 {
   367     SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
       
   368     void *function_address;
   357     void *function_address;
   369 
   358 
   370     /* Try to get function address through the egl interface */
   359     /* Try to get function address through the egl interface */
   371     function_address = eglGetProcAddress(proc);
   360     function_address = eglGetProcAddress(proc);
   372     if (function_address != NULL) {
   361     if (function_address != NULL) {
   406 SDL_GLContext
   395 SDL_GLContext
   407 PND_gl_createcontext(_THIS, SDL_Window * window)
   396 PND_gl_createcontext(_THIS, SDL_Window * window)
   408 {
   397 {
   409     SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
   398     SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
   410     SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
   399     SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
   411     SDL_DisplayData *didata =
       
   412         (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
       
   413     EGLBoolean status;
   400     EGLBoolean status;
   414     int32_t gfstatus;
       
   415     EGLint configs;
   401     EGLint configs;
   416     uint32_t attr_pos;
   402     uint32_t attr_pos;
   417     EGLint attr_value;
   403     EGLint attr_value;
   418     EGLint cit;
   404     EGLint cit;
   419 
   405 
   789 void
   775 void
   790 PND_gl_swapwindow(_THIS, SDL_Window * window)
   776 PND_gl_swapwindow(_THIS, SDL_Window * window)
   791 {
   777 {
   792     SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
   778     SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
   793     SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
   779     SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
   794     SDL_DisplayData *didata =
       
   795         (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
       
   796 
       
   797 
   780 
   798     if (phdata->egl_initialized != SDL_TRUE) {
   781     if (phdata->egl_initialized != SDL_TRUE) {
   799         SDL_SetError("PND: GLES initialization failed, no OpenGL ES support");
   782         SDL_SetError("PND: GLES initialization failed, no OpenGL ES support");
   800         return;
   783         return;
   801     }
   784     }