Solved D3D9 Alpha Blend Box Flickering

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

Lovelace

Jr.Coder
Full Member
Nobleman
Oct 23, 2015
83
938
5





As you can see from the above images, if you look at the enemy's red name tags, they're flickering. Not only that, if you look at the computer monitor on the second image, the screen completely goes white.

C++:
void FilledTransparentBox(int x, int y, int w, int h, D3DCOLOR color, IDirect3DDevice9 *d3dDevice)
{
	struct D3DVERTEX
	{
		float x, y, z, rhw;
		D3DCOLOR color;
	};

	D3DVERTEX qV[4] = {
		{ (float)x, (float)(y + h), 0.0f, 1.0f, color },
		{ (float)x, (float)y, 0.0f, 1.0f, color },
		{ (float)(x + w), (float)(y + h), 0.0f, 1.0f, color },
		{ (float)(x + w), (float)y, 0.0f, 1.0f, color }
	};
	
	d3dDevice->SetPixelShader(NULL);
	d3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
	d3dDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
	d3dDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
	d3dDevice->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE);
	d3dDevice->SetTexture(0, NULL);
	d3dDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, qV, sizeof(D3DVERTEX));
}
I'm rendering using Present. I've also tried EndScene, same result. Any solutions? I don't really have that much experience with D3D... Yeah I know, it's better if I enable the name tags through memory, but honestly, I don't know how (well, I kinda do). If any of you knows how to show enemy name tags through memory, it would be a great help. Thanks :)
 
Last edited:

Lovelace

Jr.Coder
Full Member
Nobleman
Oct 23, 2015
83
938
5
Вroihon;38286 said:
Had similar issues and now I'm using sprites instead.
nvm solved it :p



C++:
// Save device state
pDevice->GetPixelShader(&shader);
pDevice->GetRenderState(D3DRS_CULLMODE, &state1);
pDevice->GetRenderState(D3DRS_ALPHABLENDENABLE, &state2);
pDevice->GetRenderState(D3DRS_SRCBLEND, &state3);
pDevice->GetRenderState(D3DRS_DESTBLEND, &state4);

// Enable device alpha blend
pDevice->SetPixelShader(NULL);
pDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
pDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
pDevice->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1);

// Draw here

// Restore device state
pDevice->SetRenderState(D3DRS_CULLMODE, state1);
pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, state2);
pDevice->SetRenderState(D3DRS_SRCBLEND, state3);
pDevice->SetRenderState(D3DRS_DESTBLEND, state4);
pDevice->SetPixelShader(shader);
 
Last edited:

Broihon

edgy 12 y/o
Escobar Tier VIP
Fleep Tier Donator
Dec 22, 2013
1,745
40,528
316
Had similar issues and now I'm using sprites instead.
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods