Game Development Reference
In-Depth Information
5.
Default values for our pixel format chooser are:
private static int[] s_configAttribs2 =
{
EGL10.EGL_RED_SIZE, 5,
EGL10.EGL_GREEN_SIZE, 6,
EGL10.EGL_BLUE_SIZE, 5,
EGL10.EGL_ALPHA_SIZE, 0,
EGL10.EGL_DEPTH_SIZE, 16,
EGL10.EGL_STENCIL_SIZE, 0,
EGL10.EGL_SAMPLE_BUFFERS, 0,
EGL10.EGL_SAMPLES, 0,
EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL10.EGL_NONE, EGL10.EGL_NONE
};
public EGLConfig chooseConfig( EGL10 egl,
EGLDisplay display )
{
int[] num_config = new int[1];
egl.eglChooseConfig( display, s_configAttribs2,
null, 0, num_config );
int numConfigs = num_config[0];
6. Allocate and read the array of minimally matching EGL conigurations:
EGLConfig[] configs = new EGLConfig[numConfigs];
egl.eglChooseConfig( display, s_configAttribs2,
configs, numConfigs, num_config );
7.
Choose the best matching one:
return chooseConfig( egl, display, configs );
}
public EGLConfig chooseConfig( EGL10 egl,
EGLDisplay display, EGLConfig[] configs )
{
for ( EGLConfig config : configs )
{
8. Select conigurations with the speciied values for depth buffer and stencil buffer bits:
int d = findConfigAttrib( egl, display,
config, EGL10.EGL_DEPTH_SIZE, 0 );
int s = findConfigAttrib( egl, display,
config, EGL10.EGL_STENCIL_SIZE, 0 );
9.
We need at least mDepthSize and mStencilSize bits for depth and stencil:
if ( d < mDepthSize || s < mStencilSize )
{
continue;
}
 
Search WWH ::




Custom Search