Sign in to follow this  

technique to draw Sprite with fast speed?

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

i have a Sprite component, which will draw every sprites( bitmap) into a buffer( defined with dimension: 320x240)using GDI functions. - M1: if Window app want to display in a sprite its DC, this component support function to get the buffer pointer and display it into screen. - M2: if Direct3D want too, i will predefined a texture, call the get buffer pointer function, access to buffer of the texture surface, copy bit to bit and render this texture onto the screen. They all work well. However, M2 take lot of CPU process than M1, and they are all require lots of CPU process. Therefore, it is not suitable to develop this component in real time. i wonder if was something unnecessary on my technique . Can anybody explain why M2 took lot of CPU proces than M1? and how to improve this? i have do research from internet and i relize that GDI functions is not suitable for this because they used to release a slow performance,especially in Direct3D. But if i want my component to run in any kind of application(direct3D ,Direct show, Win32 app...), which technique to draw sprite image should i stand at?

Share this post


Link to post
Share on other sites
Your main problem with method 2 is that you're probably copying from system memory into video memory. It's one of the worst things you can do. You would probably get better performance copying directly to the screen.

The real answer is to write different blitters for each scenario. You want to load directly from file into your texture, only once on start-up, for maximum speed. Then you never mess with the texture again until you need to get rid of it.

By the way, Direct3D can be used in any type of complex windows application. The only reason you wouldn't want to use Direct3D is if you're working on another OS.

Share this post


Link to post
Share on other sites

This topic is 4593 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.

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