Primitives drawing under textures

Started by
3 comments, last by XSlinger 16 years, 3 months ago
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.
Advertisement
If you're drawing sprites first and your other primitives second (with no z-culling), the sprites should never be "on top".
Thats the problem, they are on top.
Are you definitely calling ID3DXSprite::End() at the appropriate point? ID3DXSprite::Draw() doesn't actually draw anything it just adds it to a list.
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

This topic is closed to new replies.

Advertisement