Jump to content
  • Advertisement
Sign in to follow this  
XSlinger

Primitives drawing under textures

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

Hello, I am using Direct3D 9. No matter what order I call the drawing of objects in, primitives (points, squares) are always drawing underneath the textures I render using an ID3DXSprite. The primitives are drawn using DrawPrimitiveUP. I have disabled the z-buffer and I am still getting the same problem. Please help.

Share this post


Link to post
Share on other sites
Advertisement
If you're drawing sprites first and your other primitives second (with no z-culling), the sprites should never be "on top".

Share this post


Link to post
Share on other sites
Are you definitely calling ID3DXSprite::End() at the appropriate point? ID3DXSprite::Draw() doesn't actually draw anything it just adds it to a list.

Share this post


Link to post
Share on other sites
Ahh thankyou that fixed my problem, but now that leads to another question.

Rather than call ID3DXSprite::Begin() once at the beginning and ID3DXSprite::End() once at the end, I put the begin and end call in my draw image function, so for each texture it draws those functions are called.

When I ran my program I found that the primitives were not drawing anymore, so I placed the Begin() and End() calls in those functions too, but I don't see why they need a sprite anyway.

It does work properly now, drawing in the correct order, but doesn't it seem inefficient to call Begin and End after every draw? The thing is, it is an engine, not a game, so I don't know in what order things will be drawn. But, is there any way I can get around this to make it more efficient?

Thanks

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!