Modulate2x

BlitzMax Forums/BlitzMax Programming/Modulate2x

Space_guy(Posted 2006) [#1]
Can someone please help me make a function to activate modulate2x blending.
I saw some code but i cant get it to work. i tried taking parts from bmax own blend commands and i made something sorta similar but not close enough.
Im sure someone knows more of directx than me and can show me the right direction.


TartanTangerine (was Indiepath)(Posted 2006) [#2]
DX7 SDK says this :

The D3DTEXTUREOP enumerated type defines per-stage texture-blending operations. The members of this type are used when setting color or alpha operations by using the D3DTSS_COLOROP or D3DTSS_ALPHAOP values with the IDirect3DDevice7::SetTextureStageState method.

typedef enum _D3DTEXTUREOP {  
    D3DTOP_DISABLE    = 1,  
    D3DTOP_SELECTARG1 = 2,  
    D3DTOP_SELECTARG2 = 3,  
    D3DTOP_MODULATE   = 4,  
    D3DTOP_MODULATE2X = 5,  
    D3DTOP_MODULATE4X = 6,  
    D3DTOP_ADD        = 7,  
    D3DTOP_ADDSIGNED  = 8,  
    D3DTOP_ADDSIGNED2X  =  9,  
    D3DTOP_SUBTRACT     = 10,  
    D3DTOP_ADDSMOOTH    = 11,  
    D3DTOP_BLENDDIFFUSEALPHA    = 12,  
    D3DTOP_BLENDTEXTUREALPHA    = 13,  
    D3DTOP_BLENDFACTORALPHA     = 14,  
    D3DTOP_BLENDTEXTUREALPHAPM  = 15,  
    D3DTOP_BLENDCURRENTALPHA    = 16,  
    D3DTOP_PREMODULATE            = 17,  
    D3DTOP_MODULATEALPHA_ADDCOLOR = 18,  
    D3DTOP_MODULATECOLOR_ADDALPHA = 19,  
    D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20,  
    D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21,  
    D3DTOP_BUMPENVMAP           = 22, 
    D3DTOP_BUMPENVMAPLUMINANCE  = 23, 
    D3DTOP_DOTPRODUCT3          = 24,
    D3DTOP_FORCE_DWORD = 0x7fffffff,  
} D3DTEXTUREOP; 

Which rougly translated to BMAX is
PrimaryDevice.Device.SetTextureStageState(D3DTSS_COLOROP,D3DTOP_MODULATE2X)
And or....
PrimaryDevice.Device.SetTextureStageState(D3DTSS_ALPHAOP,D3DTOP_MODULATE2X)



Space_guy(Posted 2006) [#3]
I dont get it to work :( And your example tells me it misses a value.

thank you alot for helping me though. its driving me crazy and i been experementing for days without understanding how to do it. now im even starting to doubt what it is i think modulate2x should do


tonyg(Posted 2006) [#4]
Graphics 800,600
image:TImage=LoadImage("max.png")
While Not KeyHit(key_escape)
  Cls
    setmod2x()
    DrawImage image,0,0
    setmodnormal()
	DrawImage image,250,0
  Flip
Wend
Function setmod2x()
		PrimaryDevice.device.SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_MODULATE2X)
End Function
Function setmodnormal()
  		PrimaryDevice.device.SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_MODULATE) 
End Function