Reply To: DX 11 implementation
You are here: Home / Latest News/Blog / Reply To: DX 11 implementation
Home › Forums › TimelineFX Module › DX 11 implementation › Reply To: DX 11 implementation
March 26, 2018 at 8:07 am
#6459
peterigz
Keymaster
Well, in blitzmax you simply do SetBlend LightBlend. But looking into the directx module that handles it all for you the setblend function looks like this: (bear in mind that this is DX9)
Method SetBlend( blend )
If blend=_active_blend Return
Select blend
Case SOLIDBLEND
_d3dDev.SetRenderState D3DRS_ALPHATESTENABLE,False
_d3dDev.SetRenderState D3DRS_ALPHABLENDENABLE,False
Case MASKBLEND
_d3dDev.SetRenderState D3DRS_ALPHATESTENABLE,True
_d3dDev.SetRenderState D3DRS_ALPHABLENDENABLE,False
Case ALPHABLEND
_d3dDev.SetRenderState D3DRS_ALPHATESTENABLE,False
_d3dDev.SetRenderState D3DRS_ALPHABLENDENABLE,True
_d3dDev.SetRenderState D3DRS_SRCBLEND,D3DBLEND_SRCALPHA
_d3dDev.SetRenderState D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA
Case LIGHTBLEND
_d3dDev.SetRenderState D3DRS_ALPHATESTENABLE,False
_d3dDev.SetRenderState D3DRS_ALPHABLENDENABLE,True
_d3dDev.SetRenderState D3DRS_SRCBLEND,D3DBLEND_SRCALPHA
_d3dDev.SetRenderState D3DRS_DESTBLEND,D3DBLEND_ONE
Case SHADEBLEND
_d3dDev.SetRenderState D3DRS_ALPHATESTENABLE,False
_d3dDev.SetRenderState D3DRS_ALPHABLENDENABLE,True
_d3dDev.SetRenderState D3DRS_SRCBLEND,D3DBLEND_ZERO
_d3dDev.SetRenderState D3DRS_DESTBLEND,D3DBLEND_SRCCOLOR
End Select
_active_blend=blend
End Method
You can find the source code for the DX9 module for blitzmax here: https://github.com/blitz-research/blitzmax/blob/master/mod/brl.mod/d3d9max2d.mod/d3d9max2d.bmx