diff --git a/src/gl/system/gl_interface.cpp b/src/gl/system/gl_interface.cpp index aaa9568f9..42224767b 100644 --- a/src/gl/system/gl_interface.cpp +++ b/src/gl/system/gl_interface.cpp @@ -179,59 +179,3 @@ void gl_PrintStartupLog() } -//========================================================================== -// -// -// -//========================================================================== - -void gl_SetTextureMode(int type) -{ - if (type == TM_MASK) - { - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); - glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PRIMARY_COLOR); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); - - glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_PRIMARY_COLOR); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA, GL_TEXTURE0); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA); - } - else if (type == TM_OPAQUE) - { - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); - glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE0); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PRIMARY_COLOR); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR); - - glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_PRIMARY_COLOR); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA); - } - else if (type == TM_INVERSE) - { - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); - glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE0); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PRIMARY_COLOR); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_ONE_MINUS_SRC_COLOR); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR); - - glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_PRIMARY_COLOR); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA, GL_TEXTURE0); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA); - } - else // if (type == TM_MODULATE) - { - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - } -} - -//} // extern "C" diff --git a/src/gl/system/gl_wipe.cpp b/src/gl/system/gl_wipe.cpp index 18c4ebfdf..e2fe134f6 100644 --- a/src/gl/system/gl_wipe.cpp +++ b/src/gl/system/gl_wipe.cpp @@ -53,6 +53,7 @@ #include "gl/renderer/gl_renderer.h" #include "gl/renderer/gl_renderstate.h" #include "gl/system/gl_framebuffer.h" +#include "gl/shaders/gl_shader.h" #include "gl/textures/gl_translate.h" #include "gl/textures/gl_material.h" #include "gl/utility/gl_templates.h" @@ -505,7 +506,27 @@ bool OpenGLFrameBuffer::Wiper_Burn::Run(int ticks, OpenGLFrameBuffer *fb) glVertex2i(fb->Width, fb->Height); glEnd(); - // the old burn warp code is obsolete and has to be replaced. + gl_RenderState.SetTextureMode(TM_MODULATE); + gl_RenderState.SetEffect(EFF_BURN); + gl_RenderState.ResetColor(); + gl_RenderState.Apply(); + + // Burn the new screen on top of it. + fb->wipeendscreen->Bind(1); + + BurnTexture->CreateTexture(rgb_buffer, WIDTH, HEIGHT, false, 0); + + glBegin(GL_TRIANGLE_STRIP); + glTexCoord2f(0, vb); + glVertex2i(0, 0); + glTexCoord2f(0, 0); + glVertex2i(0, fb->Height); + glTexCoord2f(ur, vb); + glVertex2i(fb->Width, 0); + glTexCoord2f(ur, 0); + glVertex2i(fb->Width, fb->Height); + glEnd(); + gl_RenderState.SetEffect(EFF_NONE); // The fire may not always stabilize, so the wipe is forced to end // after an arbitrary maximum time. diff --git a/src/gl/textures/gl_hwtexture.cpp b/src/gl/textures/gl_hwtexture.cpp index 3330d1f0c..9d81b54ce 100644 --- a/src/gl/textures/gl_hwtexture.cpp +++ b/src/gl/textures/gl_hwtexture.cpp @@ -218,7 +218,6 @@ void FHardwareTexture::LoadImage(unsigned char * buffer,int w, int h, unsigned i // The texture must at least be initialized if no data is present. mipmap=false; - glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, false); buffer=(unsigned char *)calloc(4,rw * (rh+1)); deletebuffer=true; //texheight=-h; @@ -228,8 +227,6 @@ void FHardwareTexture::LoadImage(unsigned char * buffer,int w, int h, unsigned i rw = GetTexDimension (w); rh = GetTexDimension (h); - glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, (mipmap && use_mipmapping && !forcenofiltering)); - if (rw < w || rh < h) { // The texture is larger than what the hardware can handle so scale it down. @@ -246,6 +243,7 @@ void FHardwareTexture::LoadImage(unsigned char * buffer,int w, int h, unsigned i if (deletebuffer) free(buffer); + if (mipmap && use_mipmapping && !forcenofiltering) glGenerateMipmap(GL_TEXTURE_2D); if (alphatexture && gl.version >= 3.3f) { static const GLint swizzleMask[] = {GL_ONE, GL_ONE, GL_ONE, GL_RED};