Font texture atlases can be created in Core Profile GL3.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2017-01-05 23:25:20 -04:00
parent 8c204efafb
commit 22c4d1ae79
3 changed files with 26 additions and 3 deletions
+8
View File
@@ -85,6 +85,14 @@ void Font::createTexture()
bool sRGB = isGammaCorrect();
OpenGL::TextureFormat fmt = gl.convertPixelFormat(pixelFormat, false, sRGB);
if (fmt.swizzled)
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, fmt.swizzle[0]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, fmt.swizzle[1]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, fmt.swizzle[2]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, fmt.swizzle[3]);
}
// Initialize the texture with transparent black.
std::vector<GLubyte> emptydata(size.width * size.height * bpp, 0);
+15 -3
View File
@@ -868,9 +868,21 @@ OpenGL::TextureFormat OpenGL::convertPixelFormat(PixelFormat pixelformat, bool r
break;
case PIXELFORMAT_LA8:
f.internalformat = GL_LUMINANCE8_ALPHA8;
f.externalformat = GL_LUMINANCE_ALPHA;
f.type = GL_UNSIGNED_BYTE;
if (gl.isCoreProfile() || GLAD_ES_VERSION_3_0)
{
f.internalformat = GL_RG8;
f.externalformat = GL_RG;
f.type = GL_UNSIGNED_BYTE;
f.swizzled = true;
f.swizzle[0] = f.swizzle[1] = f.swizzle[2] = GL_RED;
f.swizzle[3] = GL_GREEN;
}
else
{
f.internalformat = GL_LUMINANCE8_ALPHA8;
f.externalformat = GL_LUMINANCE_ALPHA;
f.type = GL_UNSIGNED_BYTE;
}
break;
case PIXELFORMAT_RGBA4:
+3
View File
@@ -92,6 +92,9 @@ public:
GLenum internalformat = 0;
GLenum externalformat = 0;
GLenum type = 0;
bool swizzled = false;
GLint swizzle[4];
};
class TempDebugGroup