fade out

Started by
1 comment, last by Pet123 15 years ago
hi there i want the dead bodys in my scene to fade out, the vertex format is <position, textureCoord> (no shader), in directx with the fixed pipeline, i can change the texture factor to achieve the alpha blending fade out effect like this


// color operation
device->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
device->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);

// alpha operation, change the 'clrCurrent' to do the fade out effect
device->SetRenderState(D3DRS_TEXTUREFACTOR, clrCurrent);
device->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
device->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TFACTOR);


I'm wondering what's the D3DRS_TEXTUREFACTOR equivalence in OGL, so i dont need to change my mesh vertex format? or any other choice i can do the trick without modifying the vertex format? thanks a lot.
Advertisement
Without knowing too much about DirectX, I don't think there's an equivalent in OpenGL to do exactly what you're doing in DX.

However, before you render your model you can set the alpha value of the model using glColor4f(); which will allow you fade the Alpha down. You will need to enable blending. And if you're going to have multiple objects near each other fading out, you will need to render from back-to-front.

Thank you AndyEsser, that's exactly what i want, thank you.

This topic is closed to new replies.

Advertisement