Need lockedbuffer version of this...

Blitz3D Forums/Blitz3D Programming/Need lockedbuffer version of this...

Shifty Geezer(Posted 2006) [#1]
This is some code from the code archives or toolbox or somewhere, "Seth's BMP Fontlib v3d.11". It's worked fine, except I've just found on my P3 600 it takes 45 ms to draw a 2 digit number! It uses CopyRect, which I've tried to replace with locked buffers and CopyPixelFast()

My unworking attempt at this conversion is :


I call this function from another function...


When run I get a MAV on 'RenderWorld tween'

Could someone smarter than I fix this to run faster? Thanks.


jfk EO-11110(Posted 2006) [#2]
I think Copyrect is pretty fast, not sure if it's worth to convert it to copypixelfast.

Drawing or poking to an imagebuffer is slow in general, since the data has to pass the bottleneck between ram and Vram. A better solution would be to do all operations on the backbuffer and copyrect the finished stuff to the image buffers.

(I know it sounds unlogical, since the backbuffer is also in Vram AFAIK. Noless, copyrect in image buffers seems to be much slower than in the backbuffer )


Shifty Geezer(Posted 2006) [#3]
You speak the truth! I tried a couple alternatives and drawing to the texture just takes 45 ms. Whereas texting to the backbuffer is much, much faster. I need to shift my text drawing to work on the backbuffer then.

This is very important info. Thanks for pointing it out to me.


Shifty Geezer(Posted 2006) [#4]
However, I found CopyRect much slower than CopyPixelFast when I did switch to writing to the backbuffer, and copying from backbuffer to texture. CopyRect didn't appear to speed up much at all this way.


Ross C(Posted 2006) [#5]
Locking the buffer has no effect on CopyRect. But copyrect is much faster for moving biggish areas. Have you tried setting the +256 flag on the texture your using?


Shifty Geezer(Posted 2006) [#6]
When I said using this method, I meant writing to backbuffer and copying to texture. Doing that, and using CopyRect, things didn't speed up much. Whereas writing to backbuffer, locking buffers and using CopyPixelFast I got a considerable speed improvement. I haven't tried setting the VRAM flag. I might give that a go, but at the moment I'm considering the program finished and am working on the website now, so tweaks are very low on the agenda.