ImageBuffer

BlitzMax Forums/BlitzMax Programming/ImageBuffer

maverick69(Posted 2005) [#1]
Ist there something similar in BlitzMax as ImageBuffers in Blitz3D. For example something likt this in B3D:

image = CreateImage(100,100)
SetBuffer ImageBuffer(image)
Rect 10,10,90,90
SetBuffer BackBuffer()
DrawImage image,0,0



Koekelas(Posted 2005) [#2]
No, there isn't.

DrawRect 10, 10, 90, 90

Local image:TImage = CreateImage(100, 100)
GrabImage(image, 0, 0)

Cls

DrawImage image, 0, 0

Flip



Nicolas.


Eikon(Posted 2005) [#3]
Problem is, GrabImage is dirt slow. This method also overwrites the image, so that you're not able to update an existing one. We really need a way to alter an image directly without drawing to the backbuffer. CopyRect would be nice too.


N(Posted 2005) [#4]
If you buy/have BlitzMax, this module will allow you to use normal 2D instead of the hardware accelerated stuff. It doesn't use Max2D so you'd have to do your own implementation of it -- I'm using this for software rendering. The code is licensed under the GNU Lesser General Public License (if you for some reason do not like the LGPL then you can jump off a bridge :D ).

ce_softdev.h


ce_softdev.c


softdevice.bmx (mod/cengine.mod/softdevice.mod/softdevice.bmx)



Koekelas(Posted 2005) [#5]
Use a pixmap to alter the image. Maverick69 is only asking for an equivalent of imagebuffer and I'm afraid grabing is the way to do it and yes this is extremely slow :).


Nicolas.


Eikon(Posted 2005) [#6]
Use a pixmap to alter the image.

How would you go about drawing a random rect directly to a PixMap/Image every loop, without clearing it, and display it? I am new to PixMaps and would appreciate an example.


Koekelas(Posted 2005) [#7]
That would be impossible whit the current BlitzMax featureset. The only way you could produce this effect is drawing the image to the backbuffer then drawing the rectangle on top of it and then grabing it again without actually flipping the backbuffer. Or you could use direct OpenGL. Don't ask me for an example, I can't do it. Don't get me wrong, I fully agree whit you.


Nicolas.


Eikon(Posted 2005) [#8]
That would be impossible whit the current BlitzMax featureset.

OK, that's what I wanted to know. I thought you were saying this was possible with the aid of PixMaps. Thanks for clearing that up.

Now we just need someone to realize how big of a problem this is and fix it...


ImaginaryHuman(Posted 2005) [#9]
You could go to OpenGL and look at using glCopyTexSubImage2D. It does not overwrite an existing texture - you set up a dummy texture, it allocate the memory, and then use that call to grab an area from the backbuffer to an area within that texture (doesn't have to be the whole texture size). It is apparently faster than a regular grab image. Still has some slowdown though.

It would be nice if Blitz Research would use that and add some Max2D commands to take advantage of it - ie GrabToImage or something.