From f839d6117f42d196ee2b3bb02f52c5b8a7614738 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sat, 30 Sep 2023 11:00:18 +1000 Subject: [PATCH] oops --- src/Graphics_Dreamcast.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/Graphics_Dreamcast.c b/src/Graphics_Dreamcast.c index c6b9a3c..53b3f2b 100644 --- a/src/Graphics_Dreamcast.c +++ b/src/Graphics_Dreamcast.c @@ -4,8 +4,7 @@ #include "Errors.h" #include "Logger.h" #include "Window.h" -#include "GL/gl.h" -#include "GL/glkos.h" +#include "../third_party/gldc/include/gldc.h" #include #include #include @@ -20,9 +19,10 @@ static cc_bool renderingDisabled; *---------------------------------------------------------General---------------------------------------------------------* *#########################################################################################################################*/ void Gfx_Create(void) { - glKosInit(); - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &Gfx.MaxTexWidth); - Gfx.MaxTexHeight = Gfx.MaxTexWidth; + if (!Gfx.Created) glKosInit(); + // NOTE: technically 1024 is supported by hardware + Gfx.MaxTexWidth = 512; + Gfx.MaxTexHeight = 512; Gfx.Created = true; Gfx_RestoreState(); } @@ -243,9 +243,10 @@ static unsigned Interleave(unsigned x) { } /*static int CalcTwiddledIndex(int x, int y, int w, int h) { - // Twiddled index looks like this (starting from lowest numbered bits): - // e.g. w > h: yx_yx_xx_xx - // e.g. h > w: yx_yx_yy_yy + // Twiddled index looks like this (lowest numbered bits are leftmost): + // - w = h: yxyx yxyx + // - w > h: yxyx xxxx + // - h > w: yxyx yyyy // And can therefore be broken down into two components: // 1) interleaved lower bits // 2) masked and then shifted higher bits @@ -485,8 +486,6 @@ static CC_NOINLINE void UnshiftTextureCoords(int count) { static void Gfx_FreeState(void) { FreeDefaultResources(); } static void Gfx_RestoreState(void) { InitDefaultResources(); - glEnableClientState(GL_VERTEX_ARRAY); - glEnableClientState(GL_COLOR_ARRAY); gfx_format = -1; glAlphaFunc(GL_GREATER, 0.5f); @@ -520,10 +519,8 @@ void Gfx_SetVertexFormat(VertexFormat fmt) { gfx_stride = strideSizes[fmt]; if (fmt == VERTEX_FORMAT_TEXTURED) { - glEnableClientState(GL_TEXTURE_COORD_ARRAY); glEnable(GL_TEXTURE_2D); } else { - glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisable(GL_TEXTURE_2D); } }