Jump to content
  • Advertisement
Sign in to follow this  
Jiia

ID3DXSprite minus texture?

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

Does anyone know if it's possible to draw untextured quads with the interface? I want to use untextured quads to draw simple 2D lines and rectangles. My only option seems to be writing my own system just for this one task. Up until now, I've been using a single-white-pixel texture. It seems strange that ID3DXSprite would disallow it, considering they most likely had to add code to prevent the null texture from passing through, rather than just allowing the pointer to flow through to the real API call. I may be wrong. I know it does do some background activities. So that's why I'm asking. Thanks

Share this post


Link to post
Share on other sites
Advertisement
Why don't you just use ID3DXLine for lines? Have you tried passing 0 to the Draw function (I assume you did, I'm just asking.) Other than that, you'd probably have to create a texture for it (just make a white one and then supply different colors to Draw().)

Share this post


Link to post
Share on other sites
Erp, sorry, I edited my post with the single-white-pixel comment as you were replying.

I have tried the null pointer and the call fails. I thought about using the ID3DXLine interface, but how does it work exactly? Does it use triangles in the same way that the sprite interface does? I'll look into it. Thanks for the suggestion :)

edit: I looked into it. Seems like it's doing exactly what I want. I should have looked before I posted. Thanks again for kicking me in the right direction :)

Share this post


Link to post
Share on other sites
No problem, just don't misuse it (like I was and a couple other people I have seen.) Its meant to be used exactly like the ID3DXSprite is (only create one instance, and then call draw for each line.)

I made a wrapper class for ID3DXSprite and ID3DXLine a while back. Then someone pee'd on my parade and told me I was dumb (my words, not theirs.)

Share this post


Link to post
Share on other sites
That's actually my biggest concern. Combining them. So far, I've always been able to combine all of the 2D drawing in one part of the loop. But now if I want to draw lines in between sprites, I have to flush one and start the other? This could happen quite often. I hope it's not a big deal.

Share this post


Link to post
Share on other sites
I didn't think about that (this is why I use vertices, indices, and buffers :)) I'll search around on google to see if I can find anything

Share this post


Link to post
Share on other sites
If I understand how it works, I think the only extra call would be changing the stream source. I don't think it can batch two seperate textures (or texture + non-texture) into one call. But I don't know what else happens in Flush().

Do you mean vertex and index buffers as in avoiding the interfaces entirely? I always assumed the interfaces did exactly that behind the scenes. I would hate to rewrite the whole system just because of this. My single pixel texture solution is looking better as I look into this, heh.

Thanks again for your help.

Share this post


Link to post
Share on other sites
Yeah, the interface does handle that all behind the scenes (and does a very good job of it.) But doing it manually lets you do stuff such as this (not to say that this is impossible with ID3DXSprite.) I'd stick with ID3DXSprite if I were you (I just like to make things harder on myself.)

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!