Multitextureing

Started by
5 comments, last by Lazy303 21 years, 11 months ago
I just want to blend to textures together. I copied this code from the "Direct3D 7 Immediate Mode Framework Programming 3: Multitexturing " article. But it doesn''t work! I'' checked the hardware, and it supports multitextureing. I even use the same textures... but I use dxsdk81 instead of 7.0 m_pd3dDevice->SetTexture(0, D3DTextr_GetSurface("wall.bmp")); m_pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE); m_pd3dDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1); // Set darkmap m_pd3dDevice->SetTexture(1, D3DTextr_GetSurface("env0.bmp")); m_pd3dDevice->SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_TEXTURE); m_pd3dDevice->SetTextureStageState(1, D3DTSS_COLORARG2, D3DTA_CURRENT);
Advertisement
And what happens?

codeka.com - Just click it.
Only the first texture is shown. whith no blending at all
You also need to set the D3DTSS_COLOROP texture state for stage 1. The default for stage 0 is D3DTOP_MODULATE, and for all other stages it''s D3DTOP_DISABLE. That means you need to add the following:

m_pd3dDevice->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_MODULATE );

Replace D3DTOP_MODULATE with whatever effect you''re looking to achieve (modulate multiples the inputs, which may not be what you want...)

codeka.com - Just click it.
I''ve tried that too...
only on texture is shown... but it''s alot darker.

I''ve used the same textures that are used in the multitexturing article
http://www.gamedev.net/reference/articles/article1028.asp
I just noticed that it does blend the to textures together...!
but it only uses the pixelcolor of the first pixel in the second texture.
Why is that?
I''ve just found out what was wrong... I only had 1 uv set...

This topic is closed to new replies.

Advertisement