Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to create a framebuffer for use of external rendering
#2
Hi,

In plain C (not C++), void* pointer means "anything goes", it's like a placeholder that accepts any data. malloc won't break, it just returns a void* pointer, it doesn't care what are you using it for. Remember that C and C++ are unmanaged languages so memory management is up to the app developer. What's important is that you declare framebuffer with a datatype that is meaningful for the kind of access/arithmetic you're going to perform on it. Tilengine doesn't care as long as it encodes a 32-bit ARGB pixel format.

C++ is more strict with pointer matching than C, and different types must be cast explicitly. So if you're declaring framebuffer with a different datatype than uint8_t*, you must cast it:

Code:
TLN_SetRenderTarget ((uint8_t*)framebuffer, pitch);

Regards,
Reply


Messages In This Thread
RE: How to create a framebuffer for use of external rendering - by megamarc - 03-01-2024, 05:44 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)