• Advertisement

Archived

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

Stretching Sprites!? Optimization?

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

Can anyone help? I have coded a StretchBlt routine for a 2D Game, for a cellphone (smartphone 2) runing windows ce (4.20), which is fast in emulation but not fast enough on my phone. I know enough about programming to understand fundementals, framework, platform etc. So I understand why. ------------------------- "Looking for a fast stretching routine of textures" Does anyone know of a stretchblt kindof source code, for a 2d game, that is fast enough, with optimazitions etc. Or a thread refering to what I''m looking for. Dun mes wit me!

Share this post


Link to post
Share on other sites
Advertisement
Do it using additive multiplication.
Read up on bresenhams linedrawer if you''re not sure about what that is.

Share this post


Link to post
Share on other sites
what about drawing the strechted image only once to a seperate surface and use that.

this would require some additional memory though, dunno how much your phone has...

---
http://jnrdev.weed-crew.net //jnrdev - the 2d jump''n''run tutorial series

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Thanks you both for your help.
I did find a Stretching Image Thread on here, but it was the same as what I programmed originally.

Bresenhams linedrawer, if i remember correctly, uses an if statement (among other things) and im trying to avoid as many operations as possible.

You have me some ideas though, and I got it optimized some more by using less multiplication, and fixed point calc.

Cheers!

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
an if statement (among other things) and im trying to avoid as many operations as possible.


Wha?



Drakonite

Shoot Pixels Not People

Share this post


Link to post
Share on other sites
cmp, jne....

i can't believe i had to explain that.

Dun mes wit me!


[edited by - Ului on April 11, 2004 9:09:16 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by Ului
cmp, jne....

i can''t believe i had to explain that.

Dun mes wit me!


[edited by - Ului on April 11, 2004 9:09:16 PM]


I meant that your "trying to avoid as many operations as possible" line makes absolutly no sense to me. So you''d rather use a slower less effecient algorythm because you don''t want to use an if statement?

*Searching for logic*
*Logic not found*



Drakonite

Shoot Pixels Not People

Share this post


Link to post
Share on other sites
oh no, for example

u could loop ova a large buffer, say 1,228,800 bytes->307,200 dwords (doing whatever calculations) as many times persecond as possible.

u r basicly checking loop condition 307,200 or whatever times.
but if u just duplicate the calcution part 16 times or so (even though it looks messy), and check it only 19,200 instead
u save "sum" cpu, may not be much but it''s a help.





Dun mes wit me!

Share this post


Link to post
Share on other sites
You also destroy the cache by unrolling like that.

Maybe I''m missunderstanding what you meant... It seemed like you meant "It uses too much variety of opcodes" and not "it does too much each pixel and therefore is too slow"



Drakonite

Shoot Pixels Not People

Share this post


Link to post
Share on other sites
a few things I learnt yesterday, or at least heard of was.
Cache Pollution, and sumthing you mentioning destroying the cache by unrolling it.

I am self taught, so like i''ve mentioned before, there is always something I was bound to miss.

You got memory, then a cache which is cpu based or something?
What is the cache, how do u not destroy it, and how is it a bad thing, when i''ve seen it can be much faster by the sarcrafice?



Dun mes wit me!

Share this post


Link to post
Share on other sites

  • Advertisement