getcolor readpixel readpixelfast

BlitzPlus Forums/BlitzPlus Programming/getcolor readpixel readpixelfast

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

You've listed the commands pretty much in speed order. GetColor is "safe" in that it won't crash if you ask it to read off screen, but this slows it down. ReadPixel will crash if reading off screen, but is a bit faster, especially if you call LockBuffer(BackBuffer()) first, and UnlockBuffer afterwards (assuming that you are reading loads in a loop). However, I never used either of those in my games, I used ReadPixelFast. You *must* lock the buffer for this to work and unlock it when you are finish. Plus you'll get Memory Access violations if you try to read outside of the screen. Also complement the use of this with WritePixelFast. You can do some pretty interesting stuff with these commands BUT they still aren't fast enough to do large areas of complex stuff like alpha blending in real-time.