• Advertisement
Sign in to follow this  

Using colors, not textures for sprites?

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

Is it possible at all? I don't want to have to draw colored quads for my GUI but instead use sprites as they're much easier to manage. However, it seems that you can only draw sprites with a texture whereas I'd just need to give said sprite a color and be done with it. I'm afraid I can't use a texture that is just one color because then I'd have to make textures for every possible color out there. Is there any way at all to just color a sprite instead of having to use a texture for it?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by rogierpennink
Is it possible at all? I don't want to have to draw colored quads for my GUI but instead use sprites as they're much easier to manage. However, it seems that you can only draw sprites with a texture whereas I'd just need to give said sprite a color and be done with it.
I'm afraid I can't use a texture that is just one color because then I'd have to make textures for every possible color out there. Is there any way at all to just color a sprite instead of having to use a texture for it?


You title sorta conflicts with your second sentence [smile].

Anyways, I take it you want to make a quad/triangle/etc. that is a specific color without specially making a texture for it?

What API and language are you using? It's done differently for everything that's different.

Share this post


Link to post
Share on other sites
Ahh yes, I should have been more specific of course. I am using Direct3D ( 9.0, april 2006 sdk ). I noticed that without specifying a valid texture in the draw method of the ID3DXSprite interface the function will fail.

Thus, it seems that I can't 'just color' the sprite. The alternative to using sprites is using colored quads but that requires me to make a vertex buffer for each new GUI element, fill it, set render states etc. whereas a sprite pretty much does that automatically.

I thought that it might maybe possible to create a texture procedurally with just one color, but I'm not sure if that's possible either and I certainly don't know how to do it :)

Share this post


Link to post
Share on other sites
sounds like you are trying to catch a fish with a shoe and are confused as to why he won't bite.

why use a sprite if you aren't going to use it like a sprite?

Share this post


Link to post
Share on other sites
I haven`t try it, but there is a color parameter in ID3DXSprite draw call. I assume you could use a white texture and set actual color with that parameter.

Share this post


Link to post
Share on other sites
Thanks Bulma, that works indeed. I just made a small (16x16) white texture and the last argument of the Draw method indeed colors it fine. All I need to do now is to get the texture stretch over any length :P

[Edited by - rogierpennink on July 29, 2006 4:14:30 AM]

Share this post


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

  • Advertisement