Let's assume I am creating an application that decodes some form of video. I've successfully created the frame, the controls, the event handlers for the controls, everything is there except for the actual rendering of the frame.
My decoding backend delivers a pointer to the frame's raw pixel data in memory -- uint32_t * width * height.
I have tried to figure out how I would go from here to displaying that frame in my app, but I can't really put the building blocks together. I've seen wxImage, wxBitmap, wxClientDC, wxGraphicsContext, and several other wx classes that might or might not need to be involved in this, and I am still fuzzy about whether I would need a specific wx control to eventually display the frame in / on, or if I would just somehow leave enough empty space on the wxWindow and render to that space itself.
I'm not asking for finished code, but rather the architectural idea in plain English. When I tried searching for documentation more specific to my problem, I ended up with either wxMediaCtrl or wxAnimationCtrl -- neither of which is what I want since I need my own specific controls -- or with drawing primitives on a bitmap (like rectangles, curves etc.) instead of blitting or displaying bitmaps.
What would be a sound way of rendering frames of raw pixel data in a wxWidgets application?
There are 2 ways to do what you want achieving decent performance:
wxGLCanvas. I won't go into details here as you can easily find examples of using OpenGL to show bitmaps.wxBitmapinternal data, then draw this bitmap in yourwxEVT_PAINThandler. See example of doing it in theimagesample.Using
wxImageis simpler but adds another conversion making it much slower than the alternatives.