mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-31 18:55:23 +01:00
Change palette size to PoT square
This commit is contained in:
committed by
Aaron van Geffen
parent
782fab93b4
commit
16b3a96e66
@@ -170,10 +170,13 @@ void TextureCache::CreateTextures()
|
||||
|
||||
void TextureCache::GeneratePaletteTexture()
|
||||
{
|
||||
rct_drawpixelinfo dpi = CreateDPI(256, PALETTE_TO_G1_OFFSET_COUNT + 5);
|
||||
static_assert(PALETTE_TO_G1_OFFSET_COUNT + 5 < 256, "Height of palette too large!");
|
||||
constexpr int32_t height = 256;
|
||||
constexpr int32_t width = height;
|
||||
rct_drawpixelinfo dpi = CreateDPI(width, height);
|
||||
|
||||
// Init no-op palette
|
||||
for (int i = 0; i < 256; ++i)
|
||||
for (int i = 0; i < width; ++i)
|
||||
{
|
||||
dpi.bits[i] = i;
|
||||
}
|
||||
@@ -191,8 +194,7 @@ void TextureCache::GeneratePaletteTexture()
|
||||
}
|
||||
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE, _paletteTexture);
|
||||
glTexImage2D(
|
||||
GL_TEXTURE_RECTANGLE, 0, GL_R8UI, 256, PALETTE_TO_G1_OFFSET_COUNT + 5, 0, GL_RED_INTEGER, GL_UNSIGNED_BYTE, dpi.bits);
|
||||
glTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_R8UI, width, height, 0, GL_RED_INTEGER, GL_UNSIGNED_BYTE, dpi.bits);
|
||||
DeleteDPI(dpi);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user