DirectX sprite performance

Started by
13 comments, last by jnye 19 years, 2 months ago
Quote:Original post by jnye
I'm trying that now, but would prefer not to use it.

I would like to maintain a little more control over my class. Do anyone know if D3DXSprite automatically handles breaking textures down if they are larger than the video card supports? Also, doesn't D3DXSprite blur the sprite...I want an exact image of my source file.


The "blurring" can be disabled in the code when you call D3DXSprite->Begin by setting these device sampler states:

D3DDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
D3DDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
D3DDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_POINT);

I would encourage you to use D3DXSprite interface.
Advertisement
Even locking/unlocking/settexture each sprite each frame you should be able to get near 10000 quads before noticing a slowdown. [assuming 128x128 textures, geforce2 or so level card].

My first naive DirectX code did this, and it was certainly acceptable.
What sort of performance do you need? Doing 100 DP calls with SetTextures between them is considerably slower than a single call, but it'll still run way over 60fps on all but really low end systems.
Drawing over 100 sprites, I'm getting less than 30 fps on a GeForce4 laptop.
Ok, I reduced my minimum texture size to 64 x 64 since most of my sprites are small and I'm getting a much better frame rate now (90fps).

I still may try some of the other optimizations mentioned here.

Thanks.

This topic is closed to new replies.

Advertisement