aevum / libgdx-cpp

A cross platform (iOS, Android, Desktop) c++ port of java's libgdx awesome framework.
Apache License 2.0
172 stars 32 forks source link

Android - Wrong blending after GL context recreating #34

Closed ufoq closed 11 years ago

ufoq commented 11 years ago

When gl context is recreated values set in glBlendFunc are no longer valid (transparent images are no longer transparent) so in GLCommon.cpp in code:


void GLCommon::glBlendFunc(int sfactor, int dfactor) const {
    static int lastSfactor = -1, lastDfactor = -1;

    if (lastSfactor != sfactor && lastDfactor != dfactor) {
        ::glBlendFunc ( sfactor, dfactor);
        lastDfactor = dfactor;
        lastSfactor = sfactor;
    }
}

lastSfactor and lastDfactor have to be reset every time gl context is recreated (or ignored like in GLCommon::glBindTexture).

scooterman commented 11 years ago

Thanks for the issue, I've commented the lines for now and will try to put the classes context aware on the future.