Readpixel?
BlitzMax Forums/BlitzMax Beginners Area/Readpixel?
| ||
I know that the command is there, but from first impression, it bares no resemblance to the BB3D version. I need to be able to draw an image onto a blank canvas (createimage) and read specific points (pixels) for my platformer. Is there any way of doing this? |
| ||
It could be worth looking here - Click here! |
| ||
Thats a good example, but reading pixels from the backbuffer is slow nowadays even on modern gfx cards. Its just they are optimised as a one way ticket sending data to the gpu, and slower getting data back. If you're making a platformer, wouldnt it be easier to use one the existing frameworks, or dont go down as low level as the pixel level, but use some kind of block structure to break the play area into more manageable sized blocks? There are plenty of proven stable frameworks for your platformer needs. |
| ||
local p:TPixmap=CreatePixmap(640,480,PF_RGBA888,4) Local PBuf:byte ptr=PixmapPixelPtr(p,0,0) Local RowLength:int=PixmapPitch(p) Then e.g. PBuf[X+(Y*RowLength)]=MyColorToWrite MyColorToRead=PBuf[X+(Y*RowLength)] or something like that. That's the fastest way to access pixels in main memory. |