Code: Select all
EGLint attribs[] =
{
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_BUFFER_SIZE, 16,
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER,
EGL_DEPTH_SIZE, 16,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT,
EGL_NONE, 0
};
EGLConfig config;
EGLint num_configs;
if (!eglChooseConfig(EglDisplay, attribs, &config, 1, &num_configs))
{
Printer::log("Could not get config for OpenGL-ES1 display.");
}
Code: Select all
else
{
s32 *p = (s32*)texture->lock();
if (!p)
{
Printer::log("Could not lock texture for making color key channel.", ELL_ERROR);
return;
}
dimension2d<u32> dim = texture->getSize();
s32 pitch = texture->getPitch() / 4;
// color with alpha disabled (fully transparent)
const s32 refZeroAlpha = 0x00ffffff & color.color;
const s32 pixels = pitch * dim.Height;
for (s32 pixel = 0; pixel < pixels; ++ pixel)
{
// If the colour matches the reference colour, ignoring alphas,
// set the alpha to zero.
if(((*p) & 0x00ffffff) == refZeroAlpha)
{
if(zeroTexels)
(*p) = 0;
else
(*p) = refZeroAlpha;
}
++p;
}
________
LOVE STORIES DICUSSION