Do you mean access the sprite data once it's loaded in a texture?
Yes, you can access its content and modify it, however this is not a fast operation as the data has to be transferred between GPU and main memory every time: GPU memory -> main memory -> modification -> GPU memory.
In addition to using bandwidth, it also forces a sync point between GPU and CPU.
Anyway, in order to do that, you need those steps:
- from your texture you need to get its bitmap with orxTexture_GetBitmap()
- then you need to allocate a buffer large enough to get the data from that bitmap, you can get the dimension of your bitmap by calling orxDisplay_GetBitmatSize(), then BufferSize = BitmapWidth * BitmapHeight * sizeof(orxRGBA)
- then fill your buffer with the content of the bitmap by calling orxDisplay_GetBitmapData()
- then modify that buffer as you see fit
- and finally send the new content back to the GPU with orxDisplay_SetBitmapData().
Can you tell us what you want to do exactly? Maybe there are better ways of achieving a similar result.
Comments
Do you mean access the sprite data once it's loaded in a texture?
Yes, you can access its content and modify it, however this is not a fast operation as the data has to be transferred between GPU and main memory every time: GPU memory -> main memory -> modification -> GPU memory.
In addition to using bandwidth, it also forces a sync point between GPU and CPU.
Anyway, in order to do that, you need those steps:
- from your texture you need to get its bitmap with orxTexture_GetBitmap()
- then you need to allocate a buffer large enough to get the data from that bitmap, you can get the dimension of your bitmap by calling orxDisplay_GetBitmatSize(), then BufferSize = BitmapWidth * BitmapHeight * sizeof(orxRGBA)
- then fill your buffer with the content of the bitmap by calling orxDisplay_GetBitmapData()
- then modify that buffer as you see fit
- and finally send the new content back to the GPU with orxDisplay_SetBitmapData().
Can you tell us what you want to do exactly? Maybe there are better ways of achieving a similar result.
does orx engine support pixel shaders?