Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 13:00, 24 August 2007.

TSS000643 - OpenGL: Selecting the correct configuration based on display mode

From Forum Nokia Wiki


Subject:

OpenGL: Selecting the correct configuration based on display mode

TSS000643

 

Platform(s): Device(s), SW version(s):
S60 3rd Edition and FP1
 
 

Category:

Symbian C++

Subcategory:

Graphics

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;
            }
        }

Creation date:

May 10, 2007

Last modified:

-
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZKnowledgeBaseContentQ
     qfnZtypeQUqfnTypeZTechnicalSolutionQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX