X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fblackberry%2Ffg_window_blackberry.c;h=c0e2ce41df52bc67a5e2d055b9b7a7d353ce1cee;hb=6b0a78a4a336ece599be9b5a26dd820030da4981;hp=e88653ca0d213fa148b51ee3c4269c65fe2b571f;hpb=efe4e8fa4b0cd10bd44965275103d14270a88df9;p=freeglut diff --git a/src/blackberry/fg_window_blackberry.c b/src/blackberry/fg_window_blackberry.c index e88653c..c0e2ce4 100644 --- a/src/blackberry/fg_window_blackberry.c +++ b/src/blackberry/fg_window_blackberry.c @@ -56,9 +56,19 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, } fgDisplay.pDisplay.single_native_window = sWindow; + /* Choose config and screen format */ + fghChooseConfig(&window->Window.pContext.egl.Config); + int screenFormat = SCREEN_FORMAT_RGBA8888; //Only SCREEN_FORMAT_RGBA8888 and SCREEN_FORMAT_RGB565 are supported. See fg_window_egl for more info + int configAttri; +#define EGL_QUERY_COMP(att, comp) (eglGetConfigAttrib(fgDisplay.pDisplay.egl.Display, window->Window.pContext.egl.Config, att, &configAttri) == GL_TRUE && (configAttri comp)) + if(EGL_QUERY_COMP(EGL_ALPHA_SIZE, <= 0) && EGL_QUERY_COMP(EGL_RED_SIZE, <= 5) && + EGL_QUERY_COMP(EGL_GREEN_SIZE, <= 6) && EGL_QUERY_COMP(EGL_BLUE_SIZE, <= 5)) { + screenFormat = SCREEN_FORMAT_RGB565; + } +#undef EGL_QUERY_COMP + /* Set window properties */ int orientation = atoi(getenv("ORIENTATION")); - int screenFormat = SCREEN_FORMAT_RGBA8888; //Only SCREEN_FORMAT_RGBA8888 and SCREEN_FORMAT_RGB565 are supported. See fg_window_egl for more info #ifdef GL_ES_VERSION_2_0 int screenUsage = SCREEN_USAGE_OPENGL_ES2 | SCREEN_USAGE_ROTATION; #elif GL_VERSION_ES_CM_1_0 || GL_VERSION_ES_CL_1_0 || GL_VERSION_ES_CM_1_1 || GL_VERSION_ES_CL_1_1 @@ -180,7 +190,6 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, window->State.IsFullscreen = GL_TRUE; //XXX Always fullscreen for now /* Create context */ - fghChooseConfig(&window->Window.pContext.egl.Config); window->Window.Context = EGL_NO_CONTEXT; if( fgState.UseCurrentContext == GL_TRUE ) window->Window.Context = eglGetCurrentContext();