我想寫一個非常簡單的影響爲它使用ID3DXSprite界面繪製2D 一個的DirectX程序-Hud。在XNA我簡單地稱爲的DirectX:如何將效果應用到與ID3DXSprite.Draw繪製紋理(..)
spriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.None);
effect.Begin();
effect.CurrentTechnique.Passes[0].Begin();
spriteBatch.Draw(texture, new Rectangle(0, 0, 300, 300), Color.White);
effect.CurrentTechnique.Passes[0].End();
effect.End();
spriteBatch.End();
但在C++中,幾乎相同的代碼does not工作
pSprite->Begin(D3DXSPRITE_ALPHABLEND | D3DXSPRITE_DONOTSAVESTATE | D3DXSPRITE_SORT_TEXTURE);
anEffect->SetTechnique(technique);
anEffect->Begin(&passes, 0);
anEffect->BeginPass(0);
pSprite->Draw(pTexture, NULL, NULL, &position, 0xFFFFFFFF);
anEffect->EndPass();
anEffect->End();
pSprite->End();
注:效果是否正確裝入!
它畫的是什麼?精靈只有紋理而沒有效果?一點都沒有? – Alan 2011-04-30 16:09:26