Description:
| Description: Since devices support different display modes, it is important to select an EGL frame buffer configuration that matches the display mode being used. For example, let’s assume that the display mode is EColor64K. EColor64K display mode uses RGBA5650 format. That is, 16 bits-per-pixel, 5 for red, 6 for blue, 5 for green, and 0 for alpha component. Checking the display mode and selecting the buffer size is done as follows: TDisplayMode mode = Window().DisplayMode(); TInt BufferSize = 0; switch(mode) { case( EColor64K ): BufferSize = 16; break; ... } Configurations are matched against the following attributes: const EGLint attrib_list[] = { EGL_SURFACE_TYPE, EGL_PBUFFER_BIT, EGL_BUFFER_SIZE, BufferSize, EGL_RED_SIZE, 5, EGL_GREEN_SIZE, 6, EGL_BLUE_SIZE, 5, EGL_ALPHA_SIZE, 0, EGL_DEPTH_SIZE, EGL_NONE }; Then, eglChooseConfig( iEglDisplay, attrib_list, configList, configSize, &numOfConfigs ); may return also RGBA8880 configurations along with RGBA5650 ones, since the results are filtered so that their attributes are equal or greater to requested ones. If the first configuration in configList is selected, the result may be that it does not match the current display mode. In this case, rendering will fail or result in a blank screen being displayed. Solution: Use the following code to filter the returned configuration list for ( TInt i = 0; i < numOfConfigs; i++ ) { EGLint red, green, blue, alpha; eglGetConfigAttrib( iEglDisplay, configList[i], EGL_RED_SIZE, &red ); eglGetConfigAttrib( iEglDisplay, configList[i], EGL_GREEN_SIZE, &green ); eglGetConfigAttrib( iEglDisplay, configList[i], EGL_BLUE_SIZE, &blue ); eglGetConfigAttrib( iEglDisplay, configList[i], EGL_ALPHA_SIZE, &alpha ); if ( red == 5 && green == 6 && blue == 5 && alpha == 0 ) { iSelectedConfig = configList[i]; break; } }
|