21 #include "../../SDL_internal.h"
23 #if SDL_VIDEO_DRIVER_PANDORA
26 #include "../SDL_sysvideo.h"
31 #include "../../events/SDL_mouse_c.h"
32 #include "../../events/SDL_keyboard_c.h"
68 status = PND_available();
98 device->
free = PND_destroy;
141 "SDL Wiz Video Driver",
144 "SDL Pandora Video Driver",
161 current_mode.
w = 320;
162 current_mode.
h = 240;
164 current_mode.
w = 800;
165 current_mode.
h = 480;
227 return SDL_SetError(
"PND: Can't get connection to OpenGL ES");
232 return SDL_SetError(
"PND: Can't init OpenGL ES library");
339 path =
"/lib/libopengles_lite.so";
341 path =
"/usr/lib/libGLES_CM.so";
349 return SDL_SetError(
"PND: Failed to locate OpenGL ES library");
363 void *function_address;
367 if (function_address !=
NULL) {
368 return function_address;
375 if (function_address !=
NULL) {
376 return function_address;
381 SDL_SetError(
"PND: Cannot locate OpenGL ES function name");
397 SDL_SetError(
"PND: GF initialization failed, no OpenGL ES support");
414 SDL_SetError(
"PND: EGL initialization failed, no OpenGL ES support");
462 wdata->gles_attributes[attr_pos++] =
469 wdata->gles_attributes[attr_pos++] =
474 wdata->gles_attributes[attr_pos] =
EGL_NONE;
478 wdata->gles_configs, 1, &configs);
480 SDL_SetError(
"PND: Can't find closest configuration for OpenGL ES");
490 for (it = 0; it < 4; it++) {
491 for (jt = 16; jt >= 0; jt--) {
511 wdata->gles_attributes[attr_pos++] = depthbits[it];
519 wdata->gles_attributes[attr_pos++] = jt;
529 wdata->gles_attributes[attr_pos] =
EGL_NONE;
534 wdata->gles_attributes,
535 wdata->gles_configs, 1, &configs);
539 (
"PND: Can't find closest configuration for OpenGL ES");
553 SDL_SetError(
"PND: Can't find any configuration for OpenGL ES");
559 wdata->gles_config = 0;
562 for (cit = 0; cit < configs; cit++) {
575 if (attr_value != 0) {
589 if (attr_value != 0) {
598 if ((depth_found != 0) && (stencil_found != 0)) {
604 if (cit == configs) {
607 wdata->gles_config = cit;
610 wdata->gles_context =
612 wdata->gles_configs[wdata->gles_config],
NULL,
NULL);
614 SDL_SetError(
"PND: OpenGL ES context creation has been failed");
623 printf(
"Error: Wiz framebuffer allocatation failed\n" );
625 printf(
"SDL: Wiz framebuffer allocated: %X\n", hNativeWnd );
628 printf(
"SDL: Wiz framebuffer already allocated: %X\n", hNativeWnd );
631 wdata->gles_surface =
633 wdata->gles_configs[wdata->gles_config],
636 wdata->gles_surface =
638 wdata->gles_configs[wdata->gles_config],
643 if (wdata->gles_surface == 0) {
651 wdata->gles_surface, wdata->gles_context);
657 SDL_SetError(
"PND: Can't set OpenGL ES context on creation");
670 wdata->gles_configs[wdata->gles_config],
677 wdata->gles_configs[wdata->gles_config],
686 wdata->gles_configs[wdata->gles_config],
693 wdata->gles_configs[wdata->gles_config],
703 return wdata->gles_context;
714 return SDL_SetError(
"PND: GF initialization failed, no OpenGL ES support");
717 if ((window ==
NULL) && (context ==
NULL)) {
723 return SDL_SetError(
"PND: Can't set OpenGL ES context");
729 (
"PND: OpenGL ES surface is not initialized for this window");
733 (
"PND: OpenGL ES context is not initialized for this window");
735 if (wdata->gles_context != context) {
737 (
"PND: OpenGL ES context is not belong to this window");
741 wdata->gles_surface, wdata->gles_context);
744 return SDL_SetError(
"PND: Can't set OpenGL ES context");
757 return SDL_SetError(
"PND: EGL initialization failed, no OpenGL ES support");
788 return SDL_SetError(
"PND: GLES initialization failed, no OpenGL ES support");
808 SDL_SetError(
"PND: GLES initialization failed, no OpenGL ES support");
825 if( hNativeWnd != 0 )
829 printf(
"SDL: Wiz framebuffer released\n" );