简体   繁体   中英

Convert RGB32 image to ofPixels in Open Frameworks

I am trying to display a video from a video decoder library. The video is delivered as a byte array with RGB32 pixel format. Meaning every pixel is represented by 32 bits.

RRBBGGFF - 8bit R, 8bit G, 8bit B, 8bit 0xFF.

Similar to QT Qimage Format_RGB32.

I thnik I need to convert the pixel array to ofPixels, Then load the pixels to ofTexture. Then I can draw the texture.

I don't know how to convert/set the ofPixels from this pixel format.

Any tips/ideas are so so welcome.

Thanks!

Try using a ofThreadChannel as described in this example in order to avoid writing and reading from your ofTexture / ofPixels .

Then you can load a uint8_t* by doing:

by using an ofTexture 's method loadFromPixels() :

// assuming data is populating the externalBuffer
void* externalBuffer;
tex.loadFromPixels((uint8*)externalData, width, height, GL_RGBA);

Hope this helps,

Best,

P

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM