Test paletted stuff
Some checks failed
Build Dusk / run-tests (push) Failing after 26s
Build Dusk / build-linux (push) Failing after 25s
Build Dusk / build-psp (push) Failing after 18s
Build Dusk / build-gamecube (push) Failing after 18s
Build Dusk / build-wii (push) Failing after 18s
Some checks failed
Build Dusk / run-tests (push) Failing after 26s
Build Dusk / build-linux (push) Failing after 25s
Build Dusk / build-psp (push) Failing after 18s
Build Dusk / build-gamecube (push) Failing after 18s
Build Dusk / build-wii (push) Failing after 18s
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "display/texture/texture.h"
|
||||
#include "assert/assert.h"
|
||||
#include "error/errorgl.h"
|
||||
#include "util/memory.h"
|
||||
|
||||
errorret_t textureInitGL(
|
||||
texturegl_t *texture,
|
||||
@@ -29,20 +30,32 @@ errorret_t textureInitGL(
|
||||
break;
|
||||
|
||||
case TEXTURE_FORMAT_PALETTE:
|
||||
assertNotNull(data.paletteData, "Palette texture data cannot be NULL");
|
||||
glTexImage2D(
|
||||
GL_TEXTURE_2D,
|
||||
0, GL_COLOR_INDEX8_EXT,
|
||||
width, height,
|
||||
0, GL_COLOR_INDEX8_EXT,
|
||||
GL_UNSIGNED_BYTE, (void*)data.paletteData
|
||||
);
|
||||
errorChain(errorGLCheck());
|
||||
|
||||
// glColorTableEXT(
|
||||
// GL_TEXTURE_2D, GL_RGBA, data.palette.palette->colorCount, GL_RGBA,
|
||||
// GL_UNSIGNED_BYTE, (const void*)data.palette.palette->colors
|
||||
// );
|
||||
assertNotNull(data.paletted.indices, "Palette indices cannot be NULL");
|
||||
assertNotNull(data.paletted.palette, "Palette colors cannot be NULL");
|
||||
#ifdef DUSK_OPENGL_LEGACY
|
||||
glTexImage2D(
|
||||
GL_TEXTURE_2D,
|
||||
0, GL_COLOR_INDEX8_EXT,
|
||||
width, height,
|
||||
0, GL_COLOR_INDEX8_EXT,
|
||||
GL_UNSIGNED_BYTE, (void*)data.paletted.indices
|
||||
);
|
||||
errorChain(errorGLCheck());
|
||||
glColorTableEXT(
|
||||
GL_TEXTURE_2D, GL_RGBA, data.paletted.palette->count, GL_RGBA,
|
||||
GL_UNSIGNED_BYTE, (const void*)data.paletted.palette->colors
|
||||
);
|
||||
errorChain(errorGLCheck());
|
||||
#else
|
||||
// For modern systems we send to only the R channel and the shader does
|
||||
// the rest.
|
||||
glTexImage2D(
|
||||
GL_TEXTURE_2D, 0, GL_RED, width, height, 0,
|
||||
GL_RED, GL_UNSIGNED_BYTE, (void*)data.paletted.indices
|
||||
);
|
||||
errorChain(errorGLCheck());
|
||||
texture->palette = data.paletted.palette;
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -69,5 +82,6 @@ errorret_t textureDisposeGL(texturegl_t *texture) {
|
||||
|
||||
glDeleteTextures(1, &texture->id);
|
||||
errorChain(errorGLCheck());
|
||||
|
||||
errorOk();
|
||||
}
|
||||
Reference in New Issue
Block a user