I am working on implementing my own 3D rendering algorithm, that will ultimately output a 2D set of "pixels", where each pixel is an RGB value. It might look something like:
int pixels[][]
What XAML control would I use to display this data A) as a static image and B) in real-time?
My initial thought conceptually with the static image would be to output my data as a bitmap, and then using an Image
control, set the source to that bitmap. So it might look something like this:
int pixels[][] = renderer.Render(sceneData);
Bitmap image = new Bitmap(pixels);
MyImageControl.Source = image;
Is this viable? What is the proper class for a "bitmap"? I am having a hard time finding one. I want to be able to individually manipulate pixel values.
For the second question, real-time, just puts the same code above, but into a loop executing (ideally) 30 to 60 or more times a second, and the output would then be more like a video rather than a single still image. It seems, based on my past UWP and C# experience, that repeatedly setting the Source
property of the Image
control would be too slow for this.
I can use existing APIs to do things like handle the image data, or display it, or transform it's formats, but the point of this exercise is for me to write my own renderer... so I need to translate input data into a final set of "pixels" myself. I cannot use DirectX or other existing renderers for this.