Progress on PSP paletted textures
Some checks failed
Build Dusk / run-tests (push) Failing after 19s
Build Dusk / build-linux (push) Failing after 17s
Build Dusk / build-psp (push) Failing after 21s
Build Dusk / build-gamecube (push) Failing after 19s
Build Dusk / build-wii (push) Failing after 15s
Some checks failed
Build Dusk / run-tests (push) Failing after 19s
Build Dusk / build-linux (push) Failing after 17s
Build Dusk / build-psp (push) Failing after 21s
Build Dusk / build-gamecube (push) Failing after 19s
Build Dusk / build-wii (push) Failing after 15s
This commit is contained in:
@@ -9,20 +9,33 @@
|
||||
|
||||
errorret_t displayOpenGLInit(void) {
|
||||
glDisable(GL_CULL_FACE);
|
||||
// glDisable(GL_LIGHTING);// PSP defaults this on?
|
||||
// glShadeModel(GL_SMOOTH); // Fixes color on PSP?
|
||||
errorChain(errorGLCheck());
|
||||
|
||||
#if DUSK_OPENGL_LEGACY
|
||||
glDisable(GL_LIGHTING);// PSP defaults this on?
|
||||
errorChain(errorGLCheck());
|
||||
glShadeModel(GL_SMOOTH); // Fixes color on PSP?
|
||||
errorChain(errorGLCheck());
|
||||
#endif
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
errorChain(errorGLCheck());
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
errorChain(errorGLCheck());
|
||||
glClearDepth(1.0f);
|
||||
errorChain(errorGLCheck());
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
errorChain(errorGLCheck());
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
errorChain(errorGLCheck());
|
||||
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||
errorChain(errorGLCheck());
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
errorChain(errorGLCheck());
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
|
||||
|
||||
errorOk();
|
||||
}
|
||||
@@ -27,7 +27,9 @@ errorret_t meshInitGL(
|
||||
#ifdef DUSK_OPENGL_LEGACY
|
||||
// Nothing needed.
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
errorChain(errorGLCheck());
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
errorChain(errorGLCheck());
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
errorChain(errorGLCheck());
|
||||
#else
|
||||
|
||||
@@ -213,7 +213,10 @@ errorret_t shaderSetTextureGL(
|
||||
assertStrLenMin(name, 1, "Uniform name cannot be empty");
|
||||
|
||||
#ifdef DUSK_OPENGL_LEGACY
|
||||
assertUnreachable("Cannot set textures on legacy opengl.");
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, texture->id);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
|
||||
#else
|
||||
GLint location;
|
||||
errorChain(shaderParamGetLocationGL(shader, name, &location));
|
||||
@@ -244,13 +247,7 @@ errorret_t shaderSetTextureGL(
|
||||
glUniform1uiv(location, texture->palette->count, paletteData);
|
||||
errorChain(errorGLCheck());
|
||||
}
|
||||
|
||||
// PALETTE TEST
|
||||
// errorChain(shaderParamGetLocationGL(shader, "u_Palette", &location));
|
||||
// glActiveTexture(GL_TEXTURE1);
|
||||
// errorChain(errorGLCheck());
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
errorOk();
|
||||
|
||||
@@ -18,6 +18,7 @@ errorret_t textureInitGL(
|
||||
const texturedata_t data
|
||||
) {
|
||||
glGenTextures(1, &texture->id);
|
||||
errorChain(errorGLCheck());
|
||||
glBindTexture(GL_TEXTURE_2D, texture->id);
|
||||
errorChain(errorGLCheck());
|
||||
|
||||
@@ -27,11 +28,12 @@ errorret_t textureInitGL(
|
||||
GL_TEXTURE_2D, 0, format, width, height, 0,
|
||||
format, GL_UNSIGNED_BYTE, (void*)data.rgbaColors
|
||||
);
|
||||
errorChain(errorGLCheck());
|
||||
break;
|
||||
|
||||
case TEXTURE_FORMAT_PALETTE:
|
||||
assertNotNull(data.paletted.indices, "Palette indices cannot be NULL");
|
||||
assertNotNull(data.paletted.palette, "Palette colors cannot be NULL");
|
||||
texture->palette = data.paletted.palette;
|
||||
|
||||
#ifdef DUSK_OPENGL_LEGACY
|
||||
glTexImage2D(
|
||||
GL_TEXTURE_2D,
|
||||
@@ -40,12 +42,13 @@ errorret_t textureInitGL(
|
||||
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
|
||||
GL_TEXTURE_2D, GL_RGBA, texture->palette->count, GL_RGBA,
|
||||
GL_UNSIGNED_BYTE, (const void*)texture->palette->colors
|
||||
);
|
||||
errorChain(errorGLCheck());
|
||||
|
||||
#else
|
||||
// For modern systems we send to only the R channel and the shader does
|
||||
// the rest.
|
||||
@@ -54,7 +57,6 @@ errorret_t textureInitGL(
|
||||
GL_RED, GL_UNSIGNED_BYTE, (void*)data.paletted.indices
|
||||
);
|
||||
errorChain(errorGLCheck());
|
||||
texture->palette = data.paletted.palette;
|
||||
#endif
|
||||
break;
|
||||
|
||||
@@ -65,8 +67,11 @@ errorret_t textureInitGL(
|
||||
errorChain(errorGLCheck());
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
errorChain(errorGLCheck());
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
errorChain(errorGLCheck());
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
errorChain(errorGLCheck());
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
errorChain(errorGLCheck());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user