PDA

View Full Version : Enabling alpha channel in OpenGL ES




Jon170686
Nov 3, 2008, 02:23 PM
How can I modify the alpha channel size through the CAEAGLLayer class (or whatever else I could do it with) used to set up the rendering for a opengl es iphone project?

Another way to put it; how do I accomplish what this CGL code does to set pixel format attributes (CGLChoosePixelFormat)?

CGLPixelFormatAttribute attribs[] = { kCGLPFADoubleBuffer,
kCGLPFAFullScreen,
kCGLPFADisplayMask,
CGDisplayIDToOpenGLDisplayMask(kCGDirectMainDisplay),
NULL
}; // 2
CGLPixelFormatObj pixelFormatObj;
long numPixelFormats ;

CGLChoosePixelFormat( attribs, &pixelFormatObj, &numPixelFormats );

Using CGLChoosePixelFormat() you can pass in properties such as kCGLPFASampleAlpha and kCGLPFAAlphaSize. How do I get to specify these starting from a standard opengl es iphone project (which I'm not sure if it can use CGL functions).

If it helps I have an old opengl GLUT project that called:
GLUTInitDisplay(GLUT_DOUBLE | .... | GLUT_ALPHA)

or it might have been GLUTInitDisplayMode... not sure.

Where the GLUT_ALPHA accomplished what I needed...

Sorry for the long post, any help is very much appreciated!