alemio
Topic Author
Posts: 5
Joined: 29 Oct 2017, 20:25

WPF pixel array

01 Nov 2017, 11:40

Hi,
currently I have a project wrote in c# and WPF. I have to send the pixel byte array of canvas content to video card.
I'm using rendertargetbitmap to get a snapshot oh this canvas and after that I use CopyPixel to copies the bitmap pixel data into a byte array.
I do that because I need alpha channel.

Could I do that with NoesisGUI?
Thank you
 
User avatar
jsantos
Site Admin
Posts: 3906
Joined: 20 Jan 2012, 17:18
Contact:

Re: WPF pixel array

01 Nov 2017, 11:57

Anything involving CopyPixel is extremely slow. Being NoesisGUI an API optimized for videogames and realtime we provide a faster way. You can render to your own GPU render target and just have the result directly in the GPU card without having to copy using the CPU.
 
alemio
Topic Author
Posts: 5
Joined: 29 Oct 2017, 20:25

Re: WPF pixel array

01 Nov 2017, 12:53

Thank you for the answer, I'm working with blackmagic decklink. Decklink function provides me an IntPtr where I write the byte array.
How I can do that?

Thank you
 
User avatar
jsantos
Site Admin
Posts: 3906
Joined: 20 Jan 2012, 17:18
Contact:

Re: WPF pixel array

02 Nov 2017, 17:51

As said, Noesis renders to the active render target (a render texture, a framebuffer, etc). How to get a byte array from that GPU buffer is something not related to Noesis and it depends on the graphics API you are using: d3d, opengl, metal or the engine: unity, unreal, c++ sdk...

Are you using Unity?
 
alemio
Topic Author
Posts: 5
Joined: 29 Oct 2017, 20:25

Re: WPF pixel array

03 Nov 2017, 09:54

Thank you for the answer,
I'm not using with Unity, I'm using with WPF, XAML and c#.
Let me explain my project
In my project I have a canvas with some controls (rectangles, text...)
WPF don't give me the frame buffer, so I need to use rendertargetbitmap to get it.
I use rendertargetbitmap because I need alpha channel. if I use BitBlt or something like that I can't have alpha channel. I have same problem if I try to extract the output data from video card.

With noesisgui can I render directly in a framebuffer?

Thank you
 
User avatar
jsantos
Site Admin
Posts: 3906
Joined: 20 Jan 2012, 17:18
Contact:

Re: WPF pixel array

03 Nov 2017, 11:52

With noesisgui can I render directly in a framebuffer?
Yes, with noesisgui you render to the current active framebuffer.
 
alemio
Topic Author
Posts: 5
Joined: 29 Oct 2017, 20:25

Re: WPF pixel array

03 Nov 2017, 12:17

Please could you give me an example how can I get this frame buffer.
What is the pixel format of this frame buffer? 8bit ARGB?

Thank you
 
User avatar
jsantos
Site Admin
Posts: 3906
Joined: 20 Jan 2012, 17:18
Contact:

Re: WPF pixel array

03 Nov 2017, 12:24

Noesis does not create the framebuffer. That's client responsibility. For example, in our OpenGL C# sample we are using glut for the initialization:
glutInit(&myargc, myargv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL);
glutInitWindowSize(windowWidth, windowHeight);
glutInitWindowPosition(0, 0);
But you can change this and even don't use glut and use a different OpenGL helper.
 
alemio
Topic Author
Posts: 5
Joined: 29 Oct 2017, 20:25

Re: WPF pixel array

03 Nov 2017, 12:34

Ok. Please tell me where can I find the pixels frame buffer in your OpenGL C# sample

Thank you
 
User avatar
jsantos
Site Admin
Posts: 3906
Joined: 20 Jan 2012, 17:18
Contact:

Re: WPF pixel array

03 Nov 2017, 13:12

I recommend glReadPixels. But, as said, this is a pure OpenGL problem.

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot], Semrush [Bot] and 7 guests