Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Multitexturing Problem

This topic is 5420 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m having some problems with using multiple texture stages. I created two textures. In stage 0, I am modulating the first texture with the diffuse color of the verticies. That part works fine, but then I want to use stage 1 to modulate the color with the color of another texture. That''s where I get stuck. The second texture has not effect. Here''s a list of all of the troubleshooting that I did. Both of my textures were created ok, because they both work when tested individually in stage 0. I checked the device caps MaxTextureBlendStages is 8 MaxSimultaneousTextures is 2 My custom vertex definition looks like this D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_DIFFUSE|D3DFVF_TEX2| D3DFVF_TEXCOORDSIZE2(0)|D3DFVF_TEXCOORDSIZE2(1) I have added the 2nd set of texture coordinates and given them values for each point of my triangle. I used the values (0,0) (1,0) and (1,1). I made sure that the textures are on input 1 of each texture stage (because some cards require this) I used SetTexture to load my first texture into stage 0 and my second one into stage 1. I set input 1 of texture stage 1 to D3DTA_TEXTURE and input 2 of texture stage 1 to D3DTA_CURRENT. Then I selected D3DTOP_SELECTARG1 for the color op on stage 1 (just to test to see if my texture is making it into texture stage 1) This is where the problem comes up. When I use SELECTARG1, the output is just white. Obviously my texture didn''t make it into texture stage 1, but I don''t know why. If I set texture stage1 to D3DTOP_SELECTARG2, the first texture that is being modulated by the diffuse color is "passed through" correctly. I am using the alpha values from the textures. I disabled the color and alpha for texture stage 2 (since I am only using stages 0 and 1) I tested my textures in MFCTex and it works. I tested my app with the reference device and it still doesn''t work. Can anyone else think of anything that I missed?

Share this post

Link to post
Share on other sites
ValidateDevice returns an HRESULT of D3D_OK and it sets pNumPasses to 1.

I''ve got it almost working now. I just realized that I forgot to set the texture stage coordinate index. I did that with the following line.

m_pd3dDevice->SetTextureStageState( 1, D3DTSS_TEXCOORDINDEX, 0);

It works fine when I''m using the same texture coordinates for stages 0 and 1, but if I change the third parameter to 1 (to use my second set of texture coordinates for stage 1) it doesn''t work.

At least I narrowed down the problem. I think there is something wrong with the way I stored the texture coordinates for stage 1.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!