Cheap & dirty image copy command

Previous topic - Next topic

Wampus

Sometimes a sprite is much more than is needed!

The sprite related functions of GLBasic are great for most 2D things; wonderful and very powerful. However, sometimes it would be very useful when speed is a necessity to be able to treat simple image copying as purely image copying, a bit like the BLIT command request from this thread: http://www.glbasic.com/forum/index.php?topic=3084.0

The reason I ask is because of this thread: http://www.glbasic.com/forum/index.php?topic=5007.0

In order to create the 2D water ripple effect I used an old 16-bit era technique to draw the background image line by line. On an iPhone screen that's 480 calls of DRAWANIM to fill the screen. Unfortunately DRAWANIM is CPU expensive so I can't use this technique without taking a big FPS hit, making it no good for 60 FPS games.

This is the forth time I've found a reason to draw a big image line by line in order to create certain effects. If there was a crude, cheap but fast way of copying an image I would benefit a lot from that.

Alternatively I could just learn enough C/C++ to do it using INLINE or something like that.

Do you think there is a need for a simpler but faster image copying command?

kaotiklabs

It would be great as those underpowered apple machines need a lot of optimization.
Vote Cthulhu! Because the stars are right!!!!
Ia Ia Cthulhu F' tang!

Kitty Hello

I don't know an OpenGL command to do that. Does anyone else?


Cliff3D

Quote from: Ocean on 2010-Sep-14I could load much larger bitmaps into memory and only pass on the parts that need to be displayed.


Regardless of the technique used behind-the-scenes to achieve it, this goal alone is a worthy one IMHO.

Kitty Hello

ah, right. Then it works:
Code (glbasic) Select

CREATESCREEN 1, 101, 512, 512
USESCREEN 1
PRINT "Test", 0,0
USESCREEN -1; USESCREEN 1 // do you need these 2 ?? I don't even think so
DRAWSPRITE 101, 10,10 // now draw the current texture INTO the current texture
USESCREEN -1
CLEARSCREEN
DRAWSPRITE 101,0,0
SHOWSCREEN
MOUSEWAIT
AWESOME