Sign in to follow this  

DirectX texture problem

This topic is 2834 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

Hey everyone, I was coding a little bit, minding my own business, when I told myself "Hey, I'll add textures to my cubes!" So, to create my cube, I used a DirectX file which contains the information about the cube as well as uv information. I can put a texture on it. The problem, now, is that I draw four cubes. I my code, the third one is the one that has the texture. It appears finely on the screen: only one cube has a texture and the three other don't. The thing is that, when I move a cube around using the arrow keys and when the cube goes in front of the textured cube, well, it goes under. To say it in other terms, the cube with the texture, as well as the fourth cube, which, in the code, is placed right after the declaration of the cube with the texture, are always drawn in front of the screen, no matter what. I tried to move one of my cube as closely as possible of the camera, those two cubes were always in front. It seems the problem comes from the texture, because when I get rid of it, it works fine (Well, I can't see much because every cubes are white in my code), but I don't why it occurs. Do you have a suggestion?

Share this post


Link to post
Share on other sites
Quote:
(Well, I can't see much because every cubes are white in my code)


First, you must be really sure the texture is the source of the problem. If you're not using lighting (I don't know, I'm speculating) and all the cubes have the same color, you won't be able to see which is in the front and which in the back. Is this your case? Do all the sides of all your cubes have exactly the same color?
If yes, try to paint them in different colors (one cube red, one blue etc.) to verify the problem isn't there even without the textures.


Btw, sounds like disabled (or wrong) z-buffering (if you verify that the texture is not the source of the problem).

Share this post


Link to post
Share on other sites
Hey thanks, I think I just learned something :) I checked, and I forgot to specify the D3DCLEAR_ZBUFFER flag in my Clear function, it works properly now, thanks.

Share this post


Link to post
Share on other sites

This topic is 2834 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this