Fix broken billboard text in legacy gl driver

This commit is contained in:
Benau 2021-04-21 10:24:29 +08:00
parent 8cae79b604
commit 7367610c1f

View File

@ -5,6 +5,12 @@
#include <vector> #include <vector>
// TODO remove it after vulkan is done
namespace irr
{
namespace video { extern bool useCoreContext; }
}
namespace GE namespace GE
{ {
GEGLTexture::GEGLTexture(const std::string& path, GEGLTexture::GEGLTexture(const std::string& path,
@ -58,12 +64,15 @@ GEGLTexture::GEGLTexture(const std::string& name, unsigned int size,
texture_swizzle = false; texture_swizzle = false;
} }
else else
texture_swizzle = GE::hasGLExtension("GL_ARB_texture_swizzle"); {
texture_swizzle = irr::video::useCoreContext &&
GE::hasGLExtension("GL_ARB_texture_swizzle");
}
if (single_channel && texture_swizzle) if (single_channel && texture_swizzle)
m_single_channel = true; m_single_channel = true;
std::vector<uint8_t> data; std::vector<uint8_t> data;
data.resize(size * size * (single_channel ? 1 : 4), 0); data.resize(size * size * (m_single_channel ? 1 : 4), 0);
upload(data.data()); upload(data.data());
} // GEGLTexture } // GEGLTexture