07-18-2018, 03:15 AM
Yeah, this one should be normalized... in C, a void* pointer means "anything goes" (an opaque type thing), but in C++ it must be explicitly cast or an error is thrown.
The actual internal format of the framebuffer is 32-bit RGBA pixels, but you can ambiguously express it as 8-bit channel values, as it's just a countiguous chunk of memory. Parameter type should express the kind of data, but there's no standard way to express 32-bit RGBA. And the "anything goes" void* isn't true either... That's why I used uint8_t*, to state that there are just bytes.
What do you think that makes more sense?
----------
The exact place in Window.c with the framebuffer/SDL texture link is here:
https://github.com/megamarc/Tilengine/bl...dow.c#L978
The actual internal format of the framebuffer is 32-bit RGBA pixels, but you can ambiguously express it as 8-bit channel values, as it's just a countiguous chunk of memory. Parameter type should express the kind of data, but there's no standard way to express 32-bit RGBA. And the "anything goes" void* isn't true either... That's why I used uint8_t*, to state that there are just bytes.
What do you think that makes more sense?
----------
The exact place in Window.c with the framebuffer/SDL texture link is here:
https://github.com/megamarc/Tilengine/bl...dow.c#L978
- The TLN_BeginWindowFrame() function locks the SDL_Texture backbuffer, acquiring direct acces to pixel data, and feeds Tilengine with this data in the next line.
- Once the frame is finished, the TLN_EndWindowFrame() function unlocks the backbuffer object, that has just get the framebuffer rendered. Now it's ready to be blitted to the window with regular SDL function calls.