Fixed whatever problem was with texture loading.
This commit is contained in:
@@ -88,6 +88,7 @@ errorret_t displayInit(void) {
|
||||
#else
|
||||
GLint mask = 0;
|
||||
glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask);
|
||||
DISPLAY.usingShaderedPalettes = true;
|
||||
if(mask & GL_CONTEXT_CORE_PROFILE_BIT) {
|
||||
GLint numExtens = 0;
|
||||
glGetIntegerv(GL_NUM_EXTENSIONS, &numExtens);
|
||||
@@ -100,7 +101,7 @@ errorret_t displayInit(void) {
|
||||
}
|
||||
} else {
|
||||
const char* ext = (const char*)glGetString(GL_EXTENSIONS);
|
||||
DISPLAY.usingShaderedPalettes = (
|
||||
DISPLAY.usingShaderedPalettes = !(
|
||||
ext && strstr(ext, "GL_EXT_paletted_texture")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ void paletteInit(
|
||||
memoryZero(palette, sizeof(palette_t));
|
||||
|
||||
palette->colorCount = colorCount;
|
||||
memoryCopy(colors, palette->colors, colorCount * sizeof(color_t));
|
||||
memoryCopy(palette->colors, colors, colorCount * sizeof(color_t));
|
||||
}
|
||||
|
||||
void paletteBind(palette_t *palette, const uint8_t slot) {
|
||||
|
||||
@@ -36,7 +36,6 @@ void textDrawChar(
|
||||
if(tileIndex < 0 || tileIndex >= tileset->tileCount) {
|
||||
tileIndex = ((int32_t)'@') - TEXT_CHAR_START;
|
||||
}
|
||||
|
||||
assertTrue(
|
||||
tileIndex >= 0 && tileIndex <= tileset->tileCount,
|
||||
"Character is out of bounds for font tiles"
|
||||
|
||||
@@ -52,12 +52,13 @@ void textureInit(
|
||||
uint8_t formatted[width * height];
|
||||
for(int32_t i = 0; i < width * height; i++) {
|
||||
uint8_t index = data.paletteData[i];
|
||||
formatted[i] = index;
|
||||
formatted[i] = index * 128;
|
||||
}
|
||||
glTexImage2D(
|
||||
GL_TEXTURE_2D, 0, GL_R, width, height, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, (void*)formatted
|
||||
GL_TEXTURE_2D, 0, GL_R8, width, height, 0,
|
||||
GL_RED, GL_UNSIGNED_BYTE, (void*)formatted
|
||||
);
|
||||
|
||||
} else {
|
||||
glTexImage2D(
|
||||
GL_TEXTURE_2D,
|
||||
@@ -66,12 +67,16 @@ void textureInit(
|
||||
0, GL_COLOR_INDEX8_EXT,
|
||||
GL_UNSIGNED_BYTE, (void*)data.paletteData
|
||||
);
|
||||
|
||||
// glColorTableEXT(
|
||||
// GL_TEXTURE_2D, GL_RGBA, data.palette.palette->colorCount, GL_RGBA,
|
||||
// GL_UNSIGNED_BYTE, (const void*)data.palette.palette->colors
|
||||
// );
|
||||
}
|
||||
|
||||
GLenum err = glGetError();
|
||||
if(err != GL_NO_ERROR) {
|
||||
assertUnreachable("GL error uploading palette texture");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -9,14 +9,12 @@
|
||||
#include "dusk.h"
|
||||
|
||||
typedef struct tileset_s {
|
||||
const char_t *name;
|
||||
const uint16_t tileWidth;
|
||||
const uint16_t tileHeight;
|
||||
const uint16_t tileCount;
|
||||
const uint16_t columns;
|
||||
const uint16_t rows;
|
||||
const vec2 uv;
|
||||
const char_t *image;
|
||||
uint16_t tileWidth;
|
||||
uint16_t tileHeight;
|
||||
uint16_t tileCount;
|
||||
uint16_t columns;
|
||||
uint16_t rows;
|
||||
vec2 uv;
|
||||
} tileset_t;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user