diff --git a/Descent3/render.cpp b/Descent3/render.cpp index 4fe2b1d7..c2af5591 100644 --- a/Descent3/render.cpp +++ b/Descent3/render.cpp @@ -1905,7 +1905,7 @@ void RenderFace(room *rp, int facenum) { else rend_SetColorModel(CM_RGB); // Set lighting map - if ((fp->flags & FF_LIGHTMAP) && (!StateLimited || UseMultitexture)) { + if ((fp->flags & FF_LIGHTMAP) != 0) { if (GameTextures[fp->tmap].flags & TF_SATURATE) rend_SetOverlayType(OT_NONE); else @@ -2345,23 +2345,6 @@ void RenderRoomUnsorted(room *rp) { for (i = rcount - 1; i >= 0; i--) { RenderFace(rp, State_elements[i].facenum); } - - if (!UseMultitexture) { - // Since we're state limited, we have to render lightmap faces completely separate - // Now render lightmap faces - rend_SetAlphaType(AT_LIGHTMAP_BLEND); - rend_SetLighting(LS_GOURAUD); - rend_SetColorModel(CM_MONO); - rend_SetOverlayType(OT_NONE); - rend_SetTextureType(TT_PERSPECTIVE); - rend_SetWrapType(WT_CLAMP); - rend_SetMipState(0); - for (i = rcount - 1; i >= 0; i--) { - RenderLightmapFace(rp, State_elements[i].facenum); - } - rend_SetWrapType(WT_WRAP); - rend_SetMipState(1); - } } } diff --git a/Descent3/terrainrender.cpp b/Descent3/terrainrender.cpp index 29c4f376..48075e61 100644 --- a/Descent3/terrainrender.cpp +++ b/Descent3/terrainrender.cpp @@ -2582,8 +2582,7 @@ void DisplayTerrainList(int cellcount, bool from_automap) { rend_SetTextureType(TT_LINEAR); rend_SetAlphaType(ATF_CONSTANT + ATF_TEXTURE); rend_SetLighting(LS_NONE); - if (!StateLimited || UseMultitexture) - draw_lightmap = true; + draw_lightmap = true; } RotateTerrainList(cellcount, from_automap); if (!UseHardware) { diff --git a/editor/TextureGrWnd.cpp b/editor/TextureGrWnd.cpp index fa627f92..b7b146c3 100644 --- a/editor/TextureGrWnd.cpp +++ b/editor/TextureGrWnd.cpp @@ -610,7 +610,6 @@ void CTextureGrWnd::TexGrStartOpenGL() { // rend_SetOpenGLWindowState (1,Descent,NULL); // LGT: not defined anymore rend_ClearScreen(0); StateLimited = 1; - UseMultitexture = 0; NoLightmaps = false; } } diff --git a/lib/renderer.h b/lib/renderer.h index 8a6e30d5..0abb3e15 100644 --- a/lib/renderer.h +++ b/lib/renderer.h @@ -329,7 +329,6 @@ extern float Z_bias; extern bool UseHardware; extern bool StateLimited; extern bool NoLightmaps; -extern bool UseMultitexture; class NewBitmap; diff --git a/model/newstyle.cpp b/model/newstyle.cpp index 9e71fb2c..cf7d3940 100644 --- a/model/newstyle.cpp +++ b/model/newstyle.cpp @@ -791,26 +791,6 @@ void RenderSubmodelFacesUnsorted(poly_model *pm, bsp_info *sm) { int facenum = State_elements[i].facenum; RenderSubmodelFace(pm, sm, facenum); } - - if (!NoLightmaps) { - if (!UseMultitexture && Polymodel_light_type == POLYMODEL_LIGHTING_LIGHTMAP) { - rend_SetAlphaType(AT_LIGHTMAP_BLEND); - rend_SetLighting(LS_GOURAUD); - rend_SetColorModel(CM_MONO); - rend_SetOverlayType(OT_NONE); - rend_SetTextureType(TT_PERSPECTIVE); - rend_SetWrapType(WT_CLAMP); - rend_SetMipState(0); - - for (i = rcount - 1; i >= 0; i--) { - int facenum = State_elements[i].facenum; - RenderSubmodelLightmapFace(pm, sm, facenum); - } - - rend_SetWrapType(WT_WRAP); - rend_SetMipState(1); - } - } } // Now render all alpha faces @@ -1027,8 +1007,7 @@ void RenderSubmodel(poly_model *pm, bsp_info *sm, uint32_t f_render_sub) { // Turn off bumpmapping if not needed rend_SetBumpmapReadyState(0, 0); } else { - if (!StateLimited || UseMultitexture) - rend_SetOverlayType(OT_BLEND); + rend_SetOverlayType(OT_BLEND); } if (Multicolor_texture == -1 && Polymodel_use_effect && (Polymodel_effect.type & PEF_CUSTOM_COLOR)) diff --git a/renderer/HardwareBaseGPU.cpp b/renderer/HardwareBaseGPU.cpp index 92c0aa38..12aa2c13 100644 --- a/renderer/HardwareBaseGPU.cpp +++ b/renderer/HardwareBaseGPU.cpp @@ -41,7 +41,6 @@ char Renderer_error_message[256] = "Generic renderer error"; bool UseHardware = true; bool NoLightmaps = false; bool StateLimited = false; -bool UseMultitexture = false; bool UseWBuffer = false; // General renderer states @@ -443,9 +442,7 @@ void rend_DrawPolygon2D(int handle, g3Point **p, int nv) { g3_RefreshTransforms(true); - if (UseMultitexture) { - gpu_SetMultitextureBlendMode(false); - } + gpu_SetMultitextureBlendMode(false); int xAdd = gpu_state.clip_x1; int yAdd = gpu_state.clip_y1; @@ -514,14 +511,12 @@ void rend_DrawPolygon3D(int handle, g3Point **p, int nv, int map_type) { return; } - if (gpu_Overlay_type != OT_NONE && UseMultitexture) { + if (gpu_Overlay_type != OT_NONE) { rend_DrawMultitexturePolygon3D(handle, p, nv, map_type); return; } - if (UseMultitexture) { - gpu_SetMultitextureBlendMode(false); - } + gpu_SetMultitextureBlendMode(false); gpu_BindTexture(handle, map_type, 0); diff --git a/renderer/HardwareOpenGL.cpp b/renderer/HardwareOpenGL.cpp index 74af9631..8cf59e9d 100644 --- a/renderer/HardwareOpenGL.cpp +++ b/renderer/HardwareOpenGL.cpp @@ -157,7 +157,6 @@ static int OpenGL_packed_pixels = 0; static int Cur_texture_object_num = 1; static int OpenGL_cache_initted = 0; static int OpenGL_last_bound[2]; -static int Last_texel_unit_set = -1; extern int gpu_last_frame_polys_drawn; extern int gpu_last_frame_verts_processed; @@ -230,12 +229,7 @@ int opengl_MakeTextureObject(int tn) { Cur_texture_object_num++; - if (UseMultitexture && Last_texel_unit_set != tn) { -#if (defined(_USE_OGL_ACTIVE_TEXTURES)) - dglActiveTextureARB(GL_TEXTURE0_ARB + tn); - Last_texel_unit_set = tn; -#endif - } + dglActiveTextureARB(GL_TEXTURE0_ARB + tn); dglBindTexture(GL_TEXTURE_2D, num); dglPixelStorei(GL_UNPACK_ALIGNMENT, 2); @@ -315,7 +309,6 @@ void opengl_SetDefaults() { rend_SetGammaValue(gpu_preferred_state.gamma); OpenGL_last_bound[0] = 9999999; OpenGL_last_bound[1] = 9999999; - Last_texel_unit_set = -1; OpenGL_multitexture_state = false; dglHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); @@ -327,19 +320,14 @@ void opengl_SetDefaults() { gpu_BindTexture(BAD_BITMAP_HANDLE, MAP_TYPE_BITMAP, 0); gpu_BindTexture(BAD_BITMAP_HANDLE, MAP_TYPE_BITMAP, 1); - if (UseMultitexture) { -#if (defined(_USE_OGL_ACTIVE_TEXTURES)) - dglActiveTextureARB(GL_TEXTURE0_ARB + 1); - dglHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); - dglHint(GL_FOG_HINT, GL_NICEST); - - gRenderer->setTextureEnabled(1, false); - dglEnable(GL_BLEND); - dglEnable(GL_DITHER); - dglBlendFunc(GL_DST_COLOR, GL_ZERO); - dglActiveTextureARB(GL_TEXTURE0_ARB + 0); -#endif - } + dglActiveTextureARB(GL_TEXTURE0_ARB + 1); + dglHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); + dglHint(GL_FOG_HINT, GL_NICEST); + gRenderer->setTextureEnabled(1, false); + dglEnable(GL_BLEND); + dglEnable(GL_DITHER); + dglBlendFunc(GL_DST_COLOR, GL_ZERO); + dglActiveTextureARB(GL_TEXTURE0_ARB + 0); } extern bool linux_permit_gamma; @@ -587,20 +575,11 @@ int opengl_Init(oeApplication *app, renderer_preferred_state *pref_state) { // Get some info opengl_GetInformation(); - // Determine if Multitexture is supported - UseMultitexture = !FindArg("-NoMultitexture") && dglActiveTextureARB && dglMultiTexCoord4f; - // Do we have packed pixel formats? OpenGL_packed_pixels = opengl_CheckExtension("GL_EXT_packed_pixels"); opengl_InitCache(); - if (UseMultitexture) { - mprintf(0, "Using multitexture."); - } else { - mprintf(0, "Not using multitexture."); - } - if (OpenGL_packed_pixels) { opengl_packed_Upload_data = (uint16_t *)mem_malloc(2048 * 2048 * 2); opengl_packed_Translate_table = (uint16_t *)mem_malloc(65536 * 2); @@ -801,12 +780,7 @@ void opengl_TranslateBitmapToOpenGL(int texnum, int bm_handle, int map_type, int int w, h; int size; - if (UseMultitexture && Last_texel_unit_set != tn) { -#if (defined(_USE_OGL_ACTIVE_TEXTURES)) - dglActiveTextureARB(GL_TEXTURE0_ARB + tn); - Last_texel_unit_set = tn; -#endif - } + dglActiveTextureARB(GL_TEXTURE0_ARB + tn); if (map_type == MAP_TYPE_LIGHTMAP) { if (GameLightmaps[bm_handle].flags & LF_BRAND_NEW) @@ -1039,12 +1013,7 @@ int opengl_MakeBitmapCurrent(int handle, int map_type, int tn) { } if (OpenGL_last_bound[tn] != texnum) { - if (UseMultitexture && Last_texel_unit_set != tn) { -#if (defined(_USE_OGL_ACTIVE_TEXTURES)) - dglActiveTextureARB(GL_TEXTURE0_ARB + tn); - Last_texel_unit_set = tn; -#endif - } + dglActiveTextureARB(GL_TEXTURE0_ARB + tn); dglBindTexture(GL_TEXTURE_2D, texnum); OpenGL_last_bound[tn] = texnum; @@ -1073,12 +1042,7 @@ void opengl_MakeWrapTypeCurrent(int handle, int map_type, int tn) { if (uwrap == dest_wrap) return; - if (UseMultitexture && Last_texel_unit_set != tn) { -#if (defined(_USE_OGL_ACTIVE_TEXTURES)) - dglActiveTextureARB(GL_TEXTURE0_ARB + tn); - Last_texel_unit_set = tn; -#endif - } + dglActiveTextureARB(GL_TEXTURE0_ARB + tn); OpenGL_sets_this_frame[1]++; @@ -1120,12 +1084,8 @@ void opengl_MakeFilterTypeCurrent(int handle, int map_type, int tn) { if (magf == dest_state) return; -#if (defined(_USE_OGL_ACTIVE_TEXTURES)) - if (UseMultitexture && Last_texel_unit_set != tn) { - dglActiveTextureARB(GL_TEXTURE0_ARB + tn); - Last_texel_unit_set = tn; - } -#endif + + dglActiveTextureARB(GL_TEXTURE0_ARB + tn); OpenGL_sets_this_frame[2]++; @@ -1163,16 +1123,11 @@ void gpu_SetMultitextureBlendMode(bool state) { return; OpenGL_multitexture_state = state; -#if (defined(_USE_OGL_ACTIVE_TEXTURES)) gRenderer->setTextureEnabled(1, state); - Last_texel_unit_set = 0; -#endif } void gpu_DrawFlatPolygon3D(g3Point **p, int nv) { - if (UseMultitexture) { - gpu_SetMultitextureBlendMode(false); - } + gpu_SetMultitextureBlendMode(false); std::array vertices{}; std::transform(p, p + nv, std::begin(vertices), [](auto pnt) { @@ -1445,12 +1400,8 @@ void rend_SetRendererType(renderer_type state) { void rend_SetLighting(light_state state) { if (state == gpu_state.cur_light_state) return; // No redundant state setting -#if (defined(_USE_OGL_ACTIVE_TEXTURES)) - if (UseMultitexture && Last_texel_unit_set != 0) { - dglActiveTextureARB(GL_TEXTURE0_ARB + 0); - Last_texel_unit_set = 0; - } -#endif + + dglActiveTextureARB(GL_TEXTURE0_ARB + 0); OpenGL_sets_this_frame[4]++; @@ -1490,12 +1441,8 @@ void rend_SetColorModel(color_model state) { void rend_SetTextureType(texture_type state) { if (state == gpu_state.cur_texture_type) return; // No redundant state setting -#if (defined(_USE_OGL_ACTIVE_TEXTURES)) - if (UseMultitexture && Last_texel_unit_set != 0) { - dglActiveTextureARB(GL_TEXTURE0_ARB + 0); - Last_texel_unit_set = 0; - } -#endif + + dglActiveTextureARB(GL_TEXTURE0_ARB + 0); OpenGL_sets_this_frame[3]++; switch (state) { @@ -1740,12 +1687,8 @@ void rend_SetFogColor(ddgr_color color) { void rend_SetAlphaType(int8_t atype) { if (atype == gpu_state.cur_alpha_type) return; // don't set it redundantly -#if (defined(_USE_OGL_ACTIVE_TEXTURES)) - if (UseMultitexture && Last_texel_unit_set != 0) { - dglActiveTextureARB(GL_TEXTURE0_ARB + 0); - Last_texel_unit_set = 0; - } -#endif + + dglActiveTextureARB(GL_TEXTURE0_ARB + 0); OpenGL_sets_this_frame[6]++; if (atype == AT_ALWAYS) { diff --git a/renderer/dyna_gl.h b/renderer/dyna_gl.h index 9fd46f79..2ea9595e 100644 --- a/renderer/dyna_gl.h +++ b/renderer/dyna_gl.h @@ -38,21 +38,6 @@ #define GLFUNCCALL #endif -// ryan's adds. 04/18/2000. -// There was a bunch of stuff that was, I guess, not supported by -// Mesa when Outrage did the original port. So buttloads of code -// involving glActiveTextureARB() were #ifdef'd to only WIN32. -// To make use of the extension more generic, platforms that can handle -// it (Linux and Win32, as far as I care), define -// _USE_OGL_ACTIVE_TEXTURES, and check that define instead of WIN32 when -// using the extension. -#if (!defined(_USE_OGL_ACTIVE_TEXTURES)) -#if (defined(WIN32)) -#define _USE_OGL_ACTIVE_TEXTURES -#endif -#endif -// end ryan's adds. - inline void CheckError() { #if defined(_DEBUG) static auto _dglGetError = reinterpret_cast(SDL_GL_GetProcAddress("glGetError")); @@ -222,10 +207,8 @@ DYNAEXTERN(glGenFramebuffersEXT); DYNAEXTERN(glGenRenderbuffersEXT); DYNAEXTERN(glRenderbufferStorageEXT); -#if defined(_USE_OGL_ACTIVE_TEXTURES) -DYNAEXTERN_OPT(glActiveTextureARB, true); -DYNAEXTERN_OPT(glMultiTexCoord4f, true); -#endif +DYNAEXTERN(glActiveTextureARB); +DYNAEXTERN(glMultiTexCoord4f); #if defined(WIN32) DYNAEXTERN(wglCreateContext);