Use the shared palette in the sample

This commit is contained in:
Luke Benstead 2019-03-04 20:56:17 +00:00
parent d89997a277
commit 2ac9cac22d

View File

@ -110,6 +110,9 @@ void LoadGLTextures() {
exit(1);
}
glEnable(GL_SHARED_TEXTURE_PALETTE_EXT);
glColorTableEXT(GL_SHARED_TEXTURE_PALETTE_EXT, GL_RGBA8, image1->palette_width, GL_RGBA, GL_UNSIGNED_BYTE, image1->palette);
// Create Texture
glGenTextures(1, &texture[0]);
glBindTexture(GL_TEXTURE_2D, texture[0]); // 2d texture (x and y size)
@ -117,8 +120,6 @@ void LoadGLTextures() {
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_LINEAR); // scale linearly when image bigger than texture
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_LINEAR); // scale linearly when image smalled than texture
glColorTableEXT(GL_TEXTURE_2D, GL_RGBA8, image1->palette_width, GL_RGBA, GL_UNSIGNED_BYTE, image1->palette);
// 2d texture, level of detail 0 (normal), 3 components (red, green, blue), x size from image, y size from image,
// border 0 (normal), rgb color data, unsigned byte data, and finally the data itself.
glTexImage2D(GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT, image1->width, image1->height, 0, GL_COLOR_INDEX, GL_UNSIGNED_BYTE_TWID_KOS, image1->data);