Archived

This topic is now archived and is closed to further replies.

What's 'wrong' with ID3DXSprite::Draw ?

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

It seems to be outputing interpolated/averaged color values for the right and bottom most pixel beyond the specified RECT. For example, if I do RECT rect = { 0, 0, 32, 32 }; sprite->Begin() sprite->Draw(texture, &rect, NULL, NULL, 0, &D3DXVECTOR2(destX, destY), color); sprite->End(); where the first 0-31 pixels in texture are white and the rest are black, then output of the 31th pixels are gray, instead of white. I currently use a hack of duplicating the right/bottom most pixel of each 32x32 tile, but this means I can only use 49/64 tiles. I can''t find any info on this behavior in the DirectX 8.1 documentation.

Share this post


Link to post
Share on other sites
From what I''ve been able to tell, problem lies with the implementation of the ID3DXSprite::Draw function, which seems to change the rendering state. Since these changes are done internally, there doesn''t seem to be any way to alter the behavior.

When I do a normal texture map onto polygons, no such anti-aliasing/filtering takes place.

Share this post


Link to post
Share on other sites
Well, the problem I''m having apparantly IS anti-aliasing. According to the article, "ID3DXSprite images are antialiased by default, hence the blurriness in figure 4. (I have no idea how to turn this off)."

The anti-aliasing is causing the right/bottom most pixel to be altered from pixels beyond the rectangle.

It seems I already handle the RECT bug by defining the bottom right pixel of the RECT as 32,32 instead of 31, 31.

Share this post


Link to post
Share on other sites
quote:

It seems I already handle the RECT bug by defining the bottom right pixel of the RECT as 32,32 instead of 31, 31.

Just because something doesn''t work the way you assume it does, doesn''t mean it''s a bug. RECTs are documented as having the bottom,right corner being exclusive. RECTs weren''t invented for DX, they''ve been around as long as the Win32 (and maybe before) as been around, and that''s how they''ve worked.

quote:
Original post by WoR
Well, the problem I''m having apparantly IS anti-aliasing. According to the article, "ID3DXSprite images are antialiased by default, hence the blurriness in figure 4. (I have no idea how to turn this off)."


Assuming you''re using D3DXSprite->Begin & End, you can change the render states after Begin.

D3DXSprite is meant to be a quick and easy prototyping tool. It won''t meet everyone''s needs, at which point you can write your own (textured quad).


Stay Casual,

Ken
Drunken Hyena

Share this post


Link to post
Share on other sites