Code in BMax

BlitzMax Forums/BlitzMax Beginners Area/Code in BMax

splinux(Posted 2005) [#1]
How can i use buffers in BMax?
How can i do this in BMax?

gfxBuffer = graphicsBuffer()
setBuffer imageBuffer(image)
lockBuffer()
argb = readPixelFast(i, j)
unlockBuffer()
setBuffer gfxBuffer()


tonyg(Posted 2005) [#2]
Lots of discussion on this.
Lockimage is what you need to do the readpixel/writepixel stuff as it only works on a pixmap.
Do a search on readpixel or writepixel for a few examples...
Manipulating pixels
This might help with drawing 2 images to an imagebuffer...
Imagebuffer-sortof


splinux(Posted 2005) [#3]
thanks


splinux(Posted 2005) [#4]
and... could i use TImage, instead of pixmaps?


FlameDuck(Posted 2005) [#5]
How can i use buffers in BMax?
You can't.

and... could i use TImage, instead of pixmaps?
No. But LockImage will return a TImages TPixmap object for manipulation. Also depending on your needs, LoadImage accepts a TPixmap object as the url.


Dreamora(Posted 2005) [#6]
Short explanation to avoid further "problems":

TImage: Image in VRAM. Can't be altered (through normal ways. Can be done through fragment programs or shader thought)

TPixmap: SystemRAM representation of the image. Can be altered. Is retransfered to graphics card every time you use drawpixmap.


Dubious Drewski(Posted 2005) [#7]
So, is it theoretically possible to edit a VRam image at all
through Bm, under any circumstances? (Besides Blendmodes, etc)


Hotcakes(Posted 2005) [#8]
In DirectX mode it should be easy enough - after all BlitzPlus did it. OpenGL mode would probably require knowledge of pixel buffers (OpenGL 1.4ish). Nobody has been game or clever enough to work it out yet.


splinux(Posted 2005) [#9]
ok, thanks a lot