HRESULT hr;
hr = D3DXCreateTextureFromFile(m_device, name1.c_str(), &m_detailTex1); if (FAILED(hr)) exit(0);
hr = D3DXCreateTextureFromFile(m_device, name2.c_str(), &m_alpha1); if (FAILED(hr)) exit(0);
//hr = D3DXCreateTextureFromFile(m_device, name3.c_str(), &m_detailTex2); if (FAILED(hr)) exit(0);
//hr = D3DXCreateTextureFromFile(m_device, name4.c_str(), &m_alpha2); if (FAILED(hr)) exit(0);
//hr = D3DXCreateTextureFromFile(m_device, name5.c_str(), &m_detailTex3); if (FAILED(hr)) exit(0);
//hr = D3DXCreateTextureFromFile(m_device, name6.c_str(), &m_alpha3); if (FAILED(hr)) exit(0);
m_device->SetTexture(0, m_tex);
m_device->SetTexture(1, m_detailTex1);
m_device->SetTexture(2, m_alpha1);
//m_device->SetTexture(4, m_detailTex2);
//m_device->SetTexture(5, m_alpha2);
//m_device->SetTexture(6, m_detailTex3);
//m_device->SetTexture(7, m_alpha3);
m_device->SetSamplerState(1, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP);
m_device->SetSamplerState(1, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP);
//base pic
m_device->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
m_device->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
// m_device->SetTextureStageState(0, D3DTSS_RESULTARG, D3DTA_TEMP);
// detail pic1
m_device->SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_TEXTURE);
m_device->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
// first alpha
m_device->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_BLENDTEXTUREALPHA);
m_device->SetTextureStageState(2, D3DTSS_COLORARG1, D3DTA_CURRENT);
m_device->SetTextureStageState(2, D3DTSS_COLORARG2, D3DTA_TEMP);
m_device->SetTextureStageState(2, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
m_device->SetTextureStageState(2, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
//m_device->SetTextureStageState(3, D3DTSS_RESULTARG, D3DTA_TEMP);
m_device->SetTextureStageState( 3, D3DTSS_COLOROP, D3DTOP_DISABLE );
m_device->SetTextureStageState( 3, D3DTSS_ALPHAOP, D3DTOP_DISABLE );
Performance very low
I use d3d texturestagestate to do mutltitexture but fps is very low 1-15/s
I just use 1 256x256 detail map and 1024 x 1024 alpha map.
2.if I use more than 2 texture I must use more than 2 coordinate in spite of the same coordinate ?
Hmm - try using a pixel shader as this may speed things up
Make sure your device is a hardware type and using hardware vertex processing.
What graphics card and processor do you have?
Make sure your device is a hardware type and using hardware vertex processing.
What graphics card and processor do you have?
Quote:Original post by Xpyder
Hmm - try using a pixel shader as this may speed things up
Make sure your device is a hardware type and using hardware vertex processing.
What graphics card and processor do you have?
CPU xp 2200 fx5200
If I disable mutltitexting performance is good . but If I load 2 texutre(detail map and alpha map) and settexturestagestate ,fps is 1-5 .
So I guess I set up incorrectly way???? Or I load too big texture?(1024 for alpha 256 for detail map)
other question:
if I use multitexture I must use multi coordinate???If yes,I how to indicate which texture will be projected to mesh by which coordinate?
Are you creating the textures every frame? It looks so from your code, you only need to load them once, this would slow you down quite a bit.
Have you enabled the debug runtimes? Do they show any warnings regarding operations which might be slow?
I have an FX5200, and it is very very slow with multi-texturing. I usually get around 40fps doing 4 textures, which is still far better than what you're doing, but way less than most high-end cards.
Also, are you testing speed using the retail runtimes? Getting error output usually slows your application quite a bit...
Have you enabled the debug runtimes? Do they show any warnings regarding operations which might be slow?
I have an FX5200, and it is very very slow with multi-texturing. I usually get around 40fps doing 4 textures, which is still far better than what you're doing, but way less than most high-end cards.
Also, are you testing speed using the retail runtimes? Getting error output usually slows your application quite a bit...
I have a 6800 so if you send me an exe of your code i could try it and give you a frame rate output
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement