PDA

View Full Version : SetTextureStageState



Chan Min
03-27-2009, 12:05 AM
okies.. Hi, OPGNL guru(s)

What is the equivalent function for m_pd3dDevice->SetTextureStageState?


and also equivalent glenum(s) for D3DTSS_COLORARG1,D3DTSS_COLORARG2,D3DTSS_COLOROP,D 3DTA_DIFFUSE?

Ilian Dinev
03-27-2009, 03:38 AM
The equivalent is a string of calls from the ancient register-combiners interface... yuck. Look at the glTexParameteri()

Chan Min
03-27-2009, 04:37 AM
not glTexEnvf???

Ilian Dinev
03-27-2009, 04:59 AM
yeah, that too. And other stuff that only tortures an implementation to do what you should do from the beginning: make shaders.

Chan Min
03-27-2009, 09:27 AM
pDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_BLENDTEXTUREALPHA );

pDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );

pDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );


PLEASE ........... SOMEBODY HELP ME....
How to write those in OPENGL?????

It is too easy for you guys...
Please answer!!!...

ruysch
03-28-2009, 12:58 PM
Its a lot easier to do those sort texture states in a shader,
Similiar under DX9 the SetTextureStageState interface is much simpler realized in a shader than through API calls, thats why you dont see that sort of API interface under DX10, its pain in the ass to work with if not realized in shaders/effects.

The amount of time spending on decoding API documentation just aint worth the effort when thou can express virtually anything you want regarding blend operations in shaders. So get up to speed is my advice ;-)

V-man
03-28-2009, 10:26 PM
I beleive that all you need is
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

which would do texture * primary_color where primary color comes from glColor if lighting is off.
If on, then it comes from the lighting calculation.