cancel
Showing results for 
Search instead for 
Did you mean: 

SDK Discussions

cosmo909
Adept I

c# FrameBufferGetInfo help

Hi i been using the c# wrapper (RadeonProRender.cs) and can after following the 32_gl_interop tutorial everything works up top the point of the FrameBufferGetInfo

here is my c# converted version

Rpr.Check((int)Rpr.FrameBufferGetInfo(g_frame_buffer_2, Rpr.FrameBuffer.DATA,
glControl.Width * glControl.Height * sizeof(float) * 4, ppObj,out sizewrect));

but getting errors is there any code examples of using c# with say opentk to get realtime rendering

0 Likes
1 Solution
cosmo909
Adept I

Ok got it working in c# Opentk in case anyone else needs it

int size = Marshal.SizeOf(g_fbdata[0]) * g_fbdata.Length;
pnt = Marshal.AllocHGlobal(size);

Marshal.Copy(g_fbdata, 0, pnt, g_fbdata.Length);

Rpr.Check((int)Rpr.FrameBufferGetInfo(g_frame_buffer_2,Rpr.FrameBuffer.DATA,(glControl.Width * glControl.Height) * sizeof(float)*4,pnt, out out_size));


float[] managedArray2 = new float[g_fbdata.Length];

Marshal.Copy(pnt, managedArray2, 0, g_fbdata.Length);

GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, glControl.Width, glControl.Height,PixelFormat.Rgba,PixelType.Float, managedArray2);

View solution in original post

0 Likes
1 Reply
cosmo909
Adept I

Ok got it working in c# Opentk in case anyone else needs it

int size = Marshal.SizeOf(g_fbdata[0]) * g_fbdata.Length;
pnt = Marshal.AllocHGlobal(size);

Marshal.Copy(g_fbdata, 0, pnt, g_fbdata.Length);

Rpr.Check((int)Rpr.FrameBufferGetInfo(g_frame_buffer_2,Rpr.FrameBuffer.DATA,(glControl.Width * glControl.Height) * sizeof(float)*4,pnt, out out_size));


float[] managedArray2 = new float[g_fbdata.Length];

Marshal.Copy(pnt, managedArray2, 0, g_fbdata.Length);

GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, glControl.Width, glControl.Height,PixelFormat.Rgba,PixelType.Float, managedArray2);

0 Likes