Code in BMax
BlitzMax Forums/BlitzMax Beginners Area/Code in BMax
| ||
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() |
| ||
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 |
| ||
thanks |
| ||
and... could i use TImage, instead of pixmaps? |
| ||
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. |
| ||
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. |
| ||
So, is it theoretically possible to edit a VRam image at all through Bm, under any circumstances? (Besides Blendmodes, etc) |
| ||
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. |
| ||
ok, thanks a lot |