Posted: 11th Jun 2007 21:17
Using FreeBASIC I created a plugin that included a simple 2D routine. The routine manipulated DBPro's backbuffer, (Get BackBuffer Ptr()). However, it runs very slow. I then created my own backbuffer, and drew onto it. This did greatly improve the routine's speed, but when I copied the buffer to DBPro's backbuffer, (Copy Memory ()) the routine slowed again. To ensure that the fault wasn't FreeBASIC, I created the routine using DevC++ and PureBASIC. All encoutered the same problem. I even rewrote the routine in Assembly.

Is there a way to copy a buffer to DBPro's backbuffer faster?
Posted: 11th Jun 2007 22:33
In DB Pro, you would LOCK PIXELS before manipulating the backbuffer, and UNLOCK PIXELS afterwards. Otherwise, you get a whole load of unnecessary stuff going that slows it down, as you have seen.
Posted: 11th Jun 2007 22:46
Thank you. However, I used "Lock Pixels" and "Unlock Pixels" to no avail. I'm certain the problem is DBPro related. I tested the same routine using FreeBASIC and it ran at 120+ FPS.
Posted: 11th Jun 2007 22:56
Then perhaps you are not using it correctly?

Post your code and we can have a look and see where the problem may be.
Posted: 11th Jun 2007 23:00
The proceduer Effect_Outline simply colors in various pixels. It is a 2D graphics routine written in Assembly.

+ Code Snippet
Function Effect_Outline()
      `Lock backbuffer
         Lock Pixels

      `Hide world
         World_Hide()

      `Copy screen to buffer
         `Copy Memory Effect_Buffer, Effect_Screen, Effect_Buffer_Bytes

      `Outline objects
         TechvanceDX_Outline RGB(255, 0, 0), RGB(0, 0, 0)

      `Copy buffer to screen
         `Copy Memory Effect_Screen, Effect_Buffer, Effect_Buffer_Bytes

      `Unlock backbuffer
         Unlock Pixels

   EndFunction
Posted: 11th Jun 2007 23:01
In the above code, ignore the parentheses before the Copy Memory () commands. That was accidently left while I was debugging.