Hello
First: I'm new to this forum, and my english is not very good. Sorry about.
My problem is. I want to write a small retro game and stuck with texture modify.
I want a texture from the size 256x256 and modify parts of it every frame.
My first thought:
local tex = Texture.new( "images/test.png", false )
local bm = Bitmap.new( tex )
One time "Texture.new", and then each frame delete bitmap and recreate it.
The texture is stored in CPU memory and the bitmap in GPU memory, right?
But how can I have access to the pixel data from the texture?
My other thought:
local size = 256
local stringbm = string.rep( string.char( 255,255,0,255 ), size*size )
local tex = Texture.new( stringbm, size, size, false, {} )
local bm = Bitmap.new( tex )
This try stores the texture data in a string. And I want to delete the bitmap and texture every frame, modify the stringbitmap, and then recreate it.
But I cannot modify the string in Lua...
Have anyone a good problem solving for me?
Comments
Likes: keszegh
Fragmenter - animated loop machine and IKONOMIKON - the memory game
I didn't think in that direction at all.
When texture and bitmap are stored in GPU memory. Then it is clear why it is not so easy to read.
Thank you very much!
Likes: keszegh