Fixed function texturing help

Started by
3 comments, last by Thergothon 16 years, 2 months ago
I know how to do this with shaders, but I can't figure out how to set up all the render states and texture stages to get this working with the fixed function pipeline. What I want to do is apply a diffuse colour to vertices using an alpha mask from a texture file. This is what I have, but it doesn't work.

	d3d_device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
	d3d_device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
	d3d_device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);

	d3d_device->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
	d3d_device->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
	
	d3d_device->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
	d3d_device->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_DIFFUSE);

Thanks s.
Advertisement
Lets just hope ntnbet picks up on this thread - he's usually pretty hot on the fixed function texture cascade [cool]

I'm pretty sure you need to get a D3DTOP_MODULATE (or D3DTOP_PREMODULATE) in there somewhere. Maybe even:

D3DTSS_COLOROP = D3DTOP_MODULATE
D3DTSS_COLORARG1 = D3DTA_DIFFUSE
D3DTSS_COLORARG2 = D3DTA_TEXTURE

??

Writing these out on paper always helped me prior to ditching FF effects.

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Thanks mate, that did it. :)
Quote:Original post by jollyjeffers
Lets just hope ntnbet picks up on this thread - he's usually pretty hot on the fixed function texture cascade [cool]
I'm struggling with the idea that someone who knows shaders is voluntarily adding fixed pipeline support. Unless a publisher makes you do it, stay away! Once the GeForce4MX and GeForceFX series are considered completely outdated, we can finally rejoice in pure shader glory. (Seriously, we just added fixed pipe support to a game because the FX series cards pixel shaders are way too slow).
I totally agree, I hate fixed function. I'm just making a game where the minimum spec is my brothers computer. Unfortunately he has some ancient video card with no shader support.

This topic is closed to new replies.

Advertisement