Wednesday, September 2, 2009

When clearing OpenGL View with alpha does not work on Oolong engine


The reason why glClear do not work was that the color format of the GL view was set to RGB565,
which seems not to provide alpha in the scene

So I changed the color format from RGB565 to RGBA8 like this and
I can see the background video and rendered scene now.

original code in delegate.m:

_glView = [[EAGLView2 alloc] initWithFrame:rect pixelFormat:GL_RGB565 depthFormat:GL_DEPTH_COMPONENT16 preserveBackbuffer:NO];

What I chanaged for solving the problem :

_glView = [[EAGLView2 alloc] initWithFrame:rect pixelFormat:GL_RGBA8_OES depthFormat:GL_DEPTH_COMPONENT16 preserveBackbuffer:NO];

Actually, you can see that the initWithFrame method initializes the color format either RGB565 or RGBA8. Please look the implementation file EAGLView2.m :

eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES],
kEAGLDrawablePropertyRetainedBacking,
(format == GL_RGB565) ? kEAGLColorFormatRGB565 : kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil];


No comments:

Post a Comment