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!
User avatar
Erick194
Posts: 35
Joined: Sat Nov 10, 2018 3:12 pm
Location: Costa Rica

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

Post by Erick194 »

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
Rachael
Posts: 13635
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: Doom 64 style lighting improvements

Post by Rachael »

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
Erick194
Posts: 35
Joined: Sat Nov 10, 2018 3:12 pm
Location: Costa Rica

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

Post by Erick194 »

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
Rachael
Posts: 13635
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

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

Post by Rachael »

User avatar
Erick194
Posts: 35
Joined: Sat Nov 10, 2018 3:12 pm
Location: Costa Rica

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

Post by Erick194 »

Ok this fixes the bug:

In gl_20.cpp you have to make the following change:

Code: Select all

//==========================================================================
//
//
//
//==========================================================================

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
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49098
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

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

Post by Graf Zahl »

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
drfrag
Vintage GZDoom Developer
Posts: 3142
Joined: Fri Apr 23, 2004 3:51 am
Location: Spain

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

Post by drfrag »

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
Erick194
Posts: 35
Joined: Sat Nov 10, 2018 3:12 pm
Location: Costa Rica

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

Post by Erick194 »

Go ahead you can take the code, just put [GEC], like the others who have collaborated with the port.
User avatar
drfrag
Vintage GZDoom Developer
Posts: 3142
Joined: Fri Apr 23, 2004 3:51 am
Location: Spain

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

Post by drfrag »

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.

Return to “Vintage Build Bugs”