// @ Project : OpenGL ES Wrapper // @ File Name : eglConfigWrapper.h // @ Date : 2006-7-5 // @ Author : kongfu.yang // @ Company : http://www.play3d.net // @ Copyright : 2006-7, Example source license. By keep this header comment, you may use this source file in your project for non-commicial or commicial purpose. #ifndef _EGL_CONFIG_WRAPPER_H_ #define _EGL_CONFIG_WRAPPER_H_ #include #define MAX_ATTRIBUTES_OF_CONFIG 0x30 struct ConfigAttribute { EGLint id; EGLint value; TCHAR * name; TCHAR * explain; }; class ConfigDescription { public: ConfigAttribute attributes[MAX_ATTRIBUTES_OF_CONFIG]; ConfigDescription() { init(); } void init() { int i = 0; attributes[i].id = EGL_BUFFER_SIZE; attributes[i].name = TEXT("EGL_BUFFER_SIZE"); attributes[i++].explain = TEXT("color buffer bits, r+g+b+ alpha"); attributes[i].id = EGL_ALPHA_SIZE; attributes[i].name = TEXT("EGL_ALPHA_SIZE"); attributes[i++].explain = TEXT("bits for alpha"); attributes[i].id = EGL_BLUE_SIZE; attributes[i].name = TEXT("EGL_BLUE_SIZE"); attributes[i++].explain = TEXT("blue color bits"); attributes[i].id = EGL_GREEN_SIZE; attributes[i].name = TEXT("EGL_GREEN_SIZE"); attributes[i++].explain = TEXT("green color bits"); attributes[i].id = EGL_RED_SIZE; attributes[i].name = TEXT("EGL_RED_SIZE"); attributes[i++].explain = TEXT("red color bits"); attributes[i].id = EGL_DEPTH_SIZE; attributes[i].name = TEXT("EGL_DEPTH_SIZE"); attributes[i++].explain = TEXT("z buffer depth"); attributes[i].id = EGL_STENCIL_SIZE; attributes[i].name = TEXT("EGL_STENCIL_SIZE"); attributes[i++].explain = TEXT("stancil bits per pixel"); attributes[i].id = EGL_CONFIG_CAVEAT; attributes[i].name = TEXT("EGL_CONFIG_CAVEAT"); attributes[i++].explain = TEXT("side effect of the config, EGL_NONE(0x3038), EGL_SLOW_CONFIG(0x3050), EGL_NON_COMFORMANT_CONFIG(0x3051,native optimized, but failed to EGL standard comformant test)"); attributes[i].id = EGL_CONFIG_ID; attributes[i].name = TEXT("EGL_CONFIG_ID"); attributes[i++].explain = TEXT("given config ID"); attributes[i].id = EGL_LEVEL; attributes[i].name = TEXT("EGL_LEVEL"); attributes[i++].explain = TEXT("0 is defalt, <0 underlay, >0 overlay"); attributes[i].id = EGL_MAX_PBUFFER_PIXELS; attributes[i].name = TEXT("EGL_MAX_PBUFFER_PIXELS"); attributes[i++].explain = TEXT("maximum pixels in a pbuffer, maybe not max_width * max_height"); attributes[i].id = EGL_MAX_PBUFFER_HEIGHT; attributes[i].name = TEXT("EGL_MAX_PBUFFER_HEIGHT"); attributes[i++].explain = TEXT("maximum pixels in y direction"); attributes[i].id = EGL_MAX_PBUFFER_WIDTH; attributes[i].name = TEXT("EGL_MAX_PBUFFER_WIDTH"); attributes[i++].explain = TEXT("maximum pixels in x direction"); attributes[i].id = EGL_NATIVE_RENDERABLE; attributes[i].name = TEXT("EGL_NATIVE_RENDERABLE"); attributes[i++].explain = TEXT("native API (GDI) can draw on EGL surface"); attributes[i].id = EGL_NATIVE_VISUAL_ID; attributes[i].name = TEXT("EGL_NATIVE_VISUAL_ID"); attributes[i++].explain = TEXT("native visual (pixel format) ID"); attributes[i].id = EGL_NATIVE_VISUAL_TYPE; attributes[i].name = TEXT("EGL_NATIVE_VISUAL_TYPE"); attributes[i++].explain = TEXT("native visual type (PIXELFORMAT) ?"); attributes[i].id = EGL_SAMPLES; attributes[i].name = TEXT("EGL_SAMPLES"); attributes[i++].explain = TEXT("sample count required by a multisampling buffer. 0 if none sample buffer"); attributes[i].id = EGL_SAMPLE_BUFFERS; attributes[i].name = TEXT("EGL_SAMPLE_BUFFERS"); attributes[i++].explain = TEXT("number of multisampling buffers"); attributes[i].id = EGL_SURFACE_TYPE; attributes[i].name = TEXT("EGL_SURFACE_TYPE"); attributes[i++].explain = TEXT("supported surface type in config, EGL_WINDOW_BIT(1)|EGL_PIXMAP_BIT(2)|EGL_PBUFFER_BIT(4)"); attributes[i].id = EGL_TRANSPARENT_TYPE; attributes[i].name = TEXT("EGL_TRANSPARENT_TYPE"); attributes[i++].explain = TEXT("support a special color as transparent. EGL_NONE(0x3038),EGL_TRANSPARENT_RGB(0x3052)"); attributes[i].id = EGL_TRANSPARENT_BLUE_VALUE; attributes[i].name = TEXT("EGL_TRANSPARENT_BLUE_VALUE"); attributes[i++].explain = TEXT("blue component of transparent color"); attributes[i].id = EGL_TRANSPARENT_GREEN_VALUE; attributes[i].name = TEXT("EGL_TRANSPARENT_GREEN_VALUE"); attributes[i++].explain = TEXT("green component of transparent color"); attributes[i].id = EGL_TRANSPARENT_RED_VALUE; attributes[i].name = TEXT("EGL_TRANSPARENT_RED_VALUE"); attributes[i++].explain = TEXT("red component of transparent color"); // EGL 1.1 attributes[i].id = EGL_BIND_TO_TEXTURE_RGB; attributes[i].name = TEXT("EGL_BIND_TO_TEXTURE_RGB"); attributes[i++].explain = TEXT("true if bindalble to RGB texture"); attributes[i].id = EGL_BIND_TO_TEXTURE_RGBA; attributes[i].name = TEXT("EGL_BIND_TO_TEXTURE_RGBA"); attributes[i++].explain = TEXT("true if bindalbe to RGBA texture"); attributes[i].id = EGL_MIN_SWAP_INTERVAL; attributes[i].name = TEXT("EGL_MIN_SWAP_INTERVAL"); attributes[i++].explain = TEXT("minimum swap interval"); attributes[i].id = EGL_MAX_SWAP_INTERVAL; attributes[i].name = TEXT("EGL_MAX_SWAP_INTERVAL"); attributes[i++].explain = TEXT("maximum swap interval"); attributes[i].id = 0; attributes[i].value = 0; attributes[i].name = 0; attributes[i++].explain = 0; } bool describe(EGLDisplay dpy, EGLConfig config) { for ( int i = 0; i < MAX_ATTRIBUTES_OF_CONFIG && attributes[i].id != 0; ++i ) { eglGetConfigAttrib( dpy, config, attributes[i].id, &attributes[i].value); } return true; } }; #endif //_EGL_CONFIG_WRAPPER_H_