New to forum, need help with writepixelfast.

Blitz3D Forums/Blitz3D Programming/New to forum, need help with writepixelfast.

DRH(Posted 2012) [#1]
I need help on a program that I've gotten to run but have had an unexpected issue with speed. My computer was built in 2005 and I know that more recent hardware wouldn't be as slow but the engine I've started to build for 2d games is unbearably slow.


DRH(Posted 2012) [#2]
The issue I have is that I can draw an image at 800,600 or even 1024,768 and there is no problem or slowdown, yet I cant find a way to draw the same amount of pixels on screen with writepixelfast or plot without serious slowdown. I bought my copy of blitz 3d back in 2006 or 2005, has any improvements been made on the plotting or writing of pixels onto the screen, backbuffer mind you, that speeds it up?


DRH(Posted 2012) [#3]
I'm sorry, I accidentally posted this into the blitz max area. please ignore or delete this.


Yasha(Posted 2012) [#4]
To answer your question anyway -

has any improvements been made on the plotting or writing of pixels onto the screen, backbuffer mind you, that speeds it up?


No. Modern hardware developments have all been in the 3D and shader realm. WritePixelFast uses pure software: you write bytes to memory from the CPU, and it uploads the altered buffer back to the GPU when you unlock it again the "slow way" (as for Plot, it locks and unlocks the buffer for every call, so that's even worse). It's completely CPU-bound and has to go through the slow channel as well to get back to the graphics card. Drawing a 1024x768 buffer with the CPU I would entirely expect to cause serious performance problems.

Drawing an image is faster because it can blit the whole thing in one fast primitive operation.

The way to do this sort of thing fast is:

- work out a way to achieve what you want using accelerated operations (i.e. polygons, trickery with 3D objects)

- use shaders, oft-demanded but not available in B3D (requires a completely different programming model)

A 2D game engine using 3D graphics (e.g. Havoc's Draw3D library) will perform much better than native B3D 2D graphics. I'd advise that you not use the 2D engine at all if you can avoid it. 2D is simply very slow.