Game Development Reference
In-Depth Information
10. We want an exact match for red/green/blue/alpha bits:
int r = findConfigAttrib( egl, display,
config, EGL10.EGL_RED_SIZE, 0 );
int g = findConfigAttrib( egl, display,
config, EGL10.EGL_GREEN_SIZE, 0 );
int b = findConfigAttrib( egl, display,
config, EGL10.EGL_BLUE_SIZE, 0 );
int a = findConfigAttrib( egl, display,
config, EGL10.EGL_ALPHA_SIZE, 0 );
if ( r == mRedSize && g == mGreenSize &&
b == mBlueSize && a == mAlphaSize )
{
return config;
}
}
return null;
}
11. Use the helper method to look for matching conigurations:
private int findConfigAttrib( EGL10 egl,
EGLDisplay display, EGLConfig config,
int attribute, int defaultValue )
{
if ( egl.eglGetConfigAttrib( display,
config, attribute, mValue ) )
{
return mValue[0];
}
return defaultValue;
}
}
12. The Renderer class delegates frame rendering callbacks to our NDK code:
private static class Renderer
implements GLSurfaceView.Renderer
{
public void onDrawFrame( GL10 gl )
{
App13Activity.DrawFrame();
}
public void onSurfaceChanged( GL10 gl,
int width, int height )
{
App13Activity.SetSurfaceSize( width, height );
}
 
Search WWH ::




Custom Search