Invulnerability effect doesn't work in Software OpenGL <=2.x

Bugs with GZDoom Vintage builds. Same rules apply as with all other bug reports fora.

Moderator: GZDoom Developers

Forum rules
Please construct and post a simple demo whenever possible for all bug reports. Please provide links to everything.

If you can include a wad demonstrating the problem, please do so. Bug reports that include fully-constructed demos have a much better chance of being investigated in a timely manner than those that don't.

Please make a new topic for every bug. Don't combine multiple bugs into a single topic. Thanks!

Invulnerability effect doesn't work in Software OpenGL <=2.x

Postby Erick194 » Sat Nov 10, 2018 8:34 pm

By the way in Gzdoom g3.7vpre-67-g098603c83 the invulnerability effect does not work correctly in Poly or Software render mode without the MESA3D library.

With MESA3D:


Without MESA3D:
User avatar
Erick194
 
Joined: 10 Nov 2018
Location: Costa Rica

Re: Doom 64 style lighting improvements

Postby Rachael » Sat Nov 10, 2018 8:39 pm

That pretty much demonstrates to a tee the deprecated state of the OpenGL 2 tree. It only happens when in legacy mode. The code to do that correctly in OpenGL 2 was never made. Nevertheless, I will split this and move it to Software bugs, but this will probably never be fixed.
User avatar
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle

Re: Invulnerability effect doesn't work in Software OpenGL <

Postby Erick194 » Sat Nov 10, 2018 8:46 pm

I solved it some time ago when the first Legacy version came out, but I need, the github of the current gzdoom legacy.
User avatar
Erick194
 
Joined: 10 Nov 2018
Location: Costa Rica

Re: Invulnerability effect doesn't work in Software OpenGL <

Postby Rachael » Sat Nov 10, 2018 9:00 pm

User avatar
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle

Re: Invulnerability effect doesn't work in Software OpenGL <

Postby Erick194 » Sat Nov 10, 2018 10:02 pm

Ok this fixes the bug:

In gl_20.cpp you have to make the following change:
Code: Select allExpand view
//==========================================================================
//
//
//
//==========================================================================

void gl_SetTextureMode(int type)
{
   if (type == TM_SWCANVAS)
   {
      int shader = V_IsTrueColor() ? 2 : 0;
      float c1[4], c2[4];

      //Old code
      /*if (gl_RenderState.mColormapState > CM_DEFAULT && gl_RenderState.mColormapState < CM_MAXCOLORMAP)
      {
         FSpecialColormap *scm = &SpecialColormaps[gl_RenderState.mColormapState - CM_FIRSTSPECIALCOLORMAP];
         for (int i = 0; i < 3; i++)
         {
            c1[i] = scm->ColorizeStart[i];
            c2[i] = scm->ColorizeEnd[i] - scm->ColorizeStart[i];
         }
         c1[3] = 0;
         c2[3] = 0;
         shader++;
      }*/

      //[GEC] Specials colormaps Fix
      if (gl_RenderState.mColormapState >= CM_FIRSTSPECIALCOLORMAP && gl_RenderState.mColormapState < CM_MAXCOLORMAPFORCED)
      {
         //Printf("ColormapState %i\n", gl_RenderState.mColormapState - CM_FIRSTSPECIALCOLORMAPFORCED);
         auto colormapState = gl_RenderState.mColormapState + CM_FIRSTSPECIALCOLORMAP - CM_FIRSTSPECIALCOLORMAPFORCED;
         if (colormapState < CM_MAXCOLORMAP)
         {
            FSpecialColormap *scm = &SpecialColormaps[colormapState - CM_FIRSTSPECIALCOLORMAP];
            for (int i = 0; i < 3; i++)
            {
               c1[i] = scm->ColorizeStart[i];
               c2[i] = scm->ColorizeEnd[i] - scm->ColorizeStart[i];
            }
            c1[3] = 0;
            c2[3] = 0;
            shader++;
         }
      }

      // Type 2 (unaltered true color) can be done without activating the shader.
      if (shader != 2)
      {
         GLRenderer->legacyShaders->BindShader(shader, c1, c2);
         return;
      }
      else type = TM_MODULATE;
   }
   glUseProgram(0);
   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_INVERTOPAQUE)
   {
      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_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_MODULATE)
   {
      glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
   }
}


Now try to fix in open gl mode.


swgl works well on my pc, the question is can be used with open gl, how to add Brightmaps?
User avatar
Erick194
 
Joined: 10 Nov 2018
Location: Costa Rica

Re: Invulnerability effect doesn't work in Software OpenGL <

Postby Graf Zahl » Sun Nov 11, 2018 1:39 am

If you talk about the software renderer, good luck with brightmaps. They essentially need a completely new set of drawers that can read from two sources and combine them. This never was implemented because it'd massively slow down things.

Another note: The fixed colormaps are already applied to the paletted output at the source. You have to make sure that you do not end up applying it twice.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Invulnerability effect doesn't work in Software OpenGL <

Postby drfrag » Sun Nov 11, 2018 3:17 pm

Erick194 wrote:Ok this fixes the bug

You could do a PR or i could apply the patch manually. So it's okay to apply this patch?
I hadn't noticed this problem until now.
User avatar
drfrag
I.R developer, I.R smart
Vintage GZDoom Developer
 
Joined: 23 Apr 2004
Location: Spain

Re: Invulnerability effect doesn't work in Software OpenGL <

Postby Erick194 » Sun Nov 11, 2018 4:58 pm

Go ahead you can take the code, just put [GEC], like the others who have collaborated with the port.
User avatar
Erick194
 
Joined: 10 Nov 2018
Location: Costa Rica

Re: Invulnerability effect doesn't work in Software OpenGL <

Postby drfrag » Wed Nov 14, 2018 2:23 pm

Thanks, just pushed it:
https://github.com/drfrag666/gzdoom/com ... 55261a2d7b

BTW do you know how to use Git/TortoiseGit, create Git diff patches or do PRs? That would be far better.
User avatar
drfrag
I.R developer, I.R smart
Vintage GZDoom Developer
 
Joined: 23 Apr 2004
Location: Spain


Return to Vintage Build Bugs

Who is online

Users browsing this forum: No registered users and 1 guest