Sign in to follow this  
Kest

ID3DXSprite: Untextured quads?

Recommended Posts

Kest    547
Is there any way to render untextured quads with ID3DXSprite? I've tried simply passing a null pointer for the texture, but I get D3DERR_INVALIDCALL. I just want to render solid pixel-based colored rectangles. Do I need to hack it and create a 1x1 or 2x2 white pixel texture? Any help is appreciated.

Share this post


Link to post
Share on other sites
Evil Steve    2017
Personally, I'd just knock up a dynamic vertex buffer and render quads from that. Aside from that, yeah - a 1x1 texture is the only real option - Although you could put several colours on one texture.

Share this post


Link to post
Share on other sites
Kest    547
I use ID3DXSprite to render all of my 2D graphical elements, so I would hate to set up an alternate system just to render solid rectangles. Is there any particular reason it throws an error when there's no texture applied? Or was it just an API development screw up?

Wouldn't other colors in the hack texture be useless? The ID3DXSprite::Draw function accepts a color modulation parameter.

Thanks for the information.

Share this post


Link to post
Share on other sites
Evil Steve    2017
Quote:
Original post by Kest
I use ID3DXSprite to render all of my 2D graphical elements, so I would hate to set up an alternate system just to render solid rectangles. Is there any particular reason it throws an error when there's no texture applied? Or was it just an API development screw up?
Presumably ID3DXSprite was only ever intended to draw textured sprites. It's just a helper class after all, and doesn't cover lots of cases.

Quote:
Original post by Kest
Wouldn't other colors in the hack texture be useless? The ID3DXSprite::Draw function accepts a color modulation parameter.
Ah yes, I forgot about that...

Share this post


Link to post
Share on other sites

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