mirror of
https://github.com/edubart/otclient.git
synced 2025-10-16 20:43:26 +02:00
fix alpha blending issues
This commit is contained in:
@@ -157,6 +157,7 @@ void FrameBuffer::internalRelease()
|
||||
// restore screen original content
|
||||
g_painter->setCompositionMode(Painter::CompositionMode_Replace);
|
||||
g_painter->drawTexturedRect(screenRect, m_screenBackup, screenRect);
|
||||
g_painter->resetCompositionMode();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -330,3 +330,14 @@ bool Graphics::canUseClampToEdge()
|
||||
return m_useClampToEdge;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Graphics::canUseBlendFuncSeparate()
|
||||
{
|
||||
#ifdef OPENGL_ES
|
||||
return true;
|
||||
#else
|
||||
if(!GLEW_VERSION_1_4)
|
||||
return false;
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
@@ -63,6 +63,7 @@ public:
|
||||
bool canUseMipmaps();
|
||||
bool canUseHardwareMipmaps();
|
||||
bool canUseClampToEdge();
|
||||
bool canUseBlendFuncSeparate();
|
||||
|
||||
private:
|
||||
Size m_viewportSize;
|
||||
|
@@ -132,7 +132,11 @@ void Painter::updateGlCompositionMode()
|
||||
{
|
||||
switch(m_compositionMode) {
|
||||
case CompositionMode_Normal:
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
if(g_graphics.canUseBlendFuncSeparate())
|
||||
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||
else {
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
break;
|
||||
case CompositionMode_Multiply:
|
||||
glBlendFunc(GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
@@ -304,7 +304,7 @@ void WIN32Window::internalChooseGLVisual()
|
||||
PFD_TYPE_RGBA,
|
||||
32, // Select Our Color Depth
|
||||
0, 0, 0, 0, 0, 0, // Color Bits Ignored
|
||||
1, // Alpha Buffer Bits
|
||||
8, // Alpha Buffer Bits
|
||||
0, // Shift Bit Ignored
|
||||
0, // No Accumulation Buffer
|
||||
0, 0, 0, 0, // Accumulation Bits Ignored
|
||||
|
Reference in New Issue
Block a user