diff --git a/src/gl/renderer/gl_renderer.cpp b/src/gl/renderer/gl_renderer.cpp index 50ef35c0b..2637f26da 100644 --- a/src/gl/renderer/gl_renderer.cpp +++ b/src/gl/renderer/gl_renderer.cpp @@ -434,7 +434,7 @@ void FGLRenderer::RenderView(player_t* player) gl_RenderState.SetVertexBuffer(mVBO); mVBO->Reset(); - if (currentrenderer == 0) + if (currentrenderer == 0 && 0) { if (swdrawer == nullptr) swdrawer = new SWSceneDrawer; swdrawer->RenderView(player); @@ -837,11 +837,6 @@ void FGLRenderer::Draw2D(F2DDrawer *drawer) gl_RenderState.mTextureMatrix.translate(0.f, 1.f, 0.0f); gl_RenderState.EnableTextureMatrix(true); } - if (cmd.mTexture->UseType == ETextureType::SWCanvas) - { - //gl_RenderState.SetTextureMode(swtruecolor ? 0 : 1); - //gl_RenderState.SetEffect(EFF_SWQUAD); - } } else { diff --git a/src/gl/shaders/gl_shader.cpp b/src/gl/shaders/gl_shader.cpp index 44d1e37a6..c174215e9 100644 --- a/src/gl/shaders/gl_shader.cpp +++ b/src/gl/shaders/gl_shader.cpp @@ -586,6 +586,7 @@ static const FDefaultShader defaultshaders[]= {"SpecularBrightmap", "shaders/glsl/func_brightmap.fp", "shaders/glsl/material_specular.fp", "#define SPECULAR\n#define NORMALMAP\n"}, {"PBR","shaders/glsl/func_normal.fp", "shaders/glsl/material_pbr.fp", "#define PBR\n#define NORMALMAP\n"}, {"PBRBrightmap","shaders/glsl/func_brightmap.fp", "shaders/glsl/material_pbr.fp", "#define PBR\n#define NORMALMAP\n"}, + {"Paletted", "shaders/glsl/func_paletted.fp", "shaders/glsl/material_nolight.fp", ""}, {"No Texture", "shaders/glsl/func_notexture.fp", "shaders/glsl/material_normal.fp", ""}, {"Basic Fuzz", "shaders/glsl/fuzz_standard.fp", "shaders/glsl/material_normal.fp", ""}, {"Smooth Fuzz", "shaders/glsl/fuzz_smooth.fp", "shaders/glsl/material_normal.fp", ""}, diff --git a/src/gl/textures/gl_material.cpp b/src/gl/textures/gl_material.cpp index 561294eae..be71fffd2 100644 --- a/src/gl/textures/gl_material.cpp +++ b/src/gl/textures/gl_material.cpp @@ -327,7 +327,11 @@ FMaterial::FMaterial(FTexture * tx, bool expanded) } else */ - if (tx->bWarped) + if (tx->UseType == ETextureType::SWCanvas && tx->WidthBits == 0) + { + mShaderIndex = SHADER_Paletted; + } + else if (tx->bWarped) { mShaderIndex = tx->bWarped; // This picks SHADER_Warp1 or SHADER_Warp2 tx->shaderspeed = static_cast(tx)->GetSpeed(); @@ -620,6 +624,7 @@ void FMaterial::Bind(int clampmode, int translation) int usebright = false; int maxbound = 0; + if (tex->UseType == ETextureType::SWCanvas) clampmode = CLAMP_NOFILTER; if (tex->bHasCanvas) clampmode = CLAMP_CAMTEX; else if (tex->bWarped && clampmode <= CLAMP_XY) clampmode = CLAMP_NONE; diff --git a/src/posix/sdl/hardware.cpp b/src/posix/sdl/hardware.cpp index 57bafcd3d..418deab3f 100644 --- a/src/posix/sdl/hardware.cpp +++ b/src/posix/sdl/hardware.cpp @@ -84,8 +84,8 @@ CUSTOM_CVAR (Int, vid_renderer, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINI self = 0; // make sure to actually switch to the software renderer break; } - Printf("You must restart " GAMENAME " to switch the renderer\n"); } + currentrenderer = self; } void I_ShutdownGraphics () diff --git a/src/textures/textures.h b/src/textures/textures.h index 6e8a3aec3..ec6b3f7f6 100644 --- a/src/textures/textures.h +++ b/src/textures/textures.h @@ -54,6 +54,7 @@ enum MaterialShaderIndex SHADER_SpecularBrightmap, SHADER_PBR, SHADER_PBRBrightmap, + SHADER_Paletted, SHADER_NoTexture, SHADER_BasicFuzz, SHADER_SmoothFuzz, diff --git a/wadsrc/static/shaders/glsl/func_paletted.fp b/wadsrc/static/shaders/glsl/func_paletted.fp new file mode 100644 index 000000000..fbcd99234 --- /dev/null +++ b/wadsrc/static/shaders/glsl/func_paletted.fp @@ -0,0 +1,10 @@ + +vec4 ProcessTexel() +{ + float index = getTexel(vTexCoord.st).r; + index = ((index * 255.0) + 0.5) / 256.0; + vec4 tex = texture(texture2, vec2(index, 0.5)); + tex.a = 1.0; + return tex; +} +