简体   繁体   中英

DirectX equivalent of glBlendFunc(…)

I created a particle System in OpenGl that's working great. When I want to get a burning effect of a fire or a beam or something(Where the system kind of "glows" and fuses all the colors together) I use this method call with OpenGL.

glBlendFunc(GL_SRC_ALPHA,GL_SRC_ALPHA) 
glBlendFunc(GL_DST_ALPHA,GL_ONE)

I'm now trying to do the same thing using Direct3D

Here is what I have tried:

graphicsDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
graphicsDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
graphicsDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);

but this has absolutely no effect at all on the look of my game! Anyone have a clue what could be the problem?

I ended up just switching to OpenGL. But thanks for the help guys :D

Try:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM