
Help with "GL.MapBuffer ()"
Posted Tuesday, 6 July, 2010 - 17:07 by migueltk inHello, ....
In the following code I get an error when compiling:
float[] array; array = (float[])GL.MapBuffer(BufferTarget.ArrayBuffer, BufferAccess.WriteOnly);
Error: Can not convert type 'System.IntPtr' to 'float []'
How I can do the assignment correctly?
Help, please ...
Regards, ...


Comments
Re: Help with "GL.MapBuffer ()"
GL.MapBuffer()returns a pointer to a blob of unmanaged memory. AFAIK, you have two options:IntPtrtofloat*:The first approach is likely to be faster.
Re: Help with "GL.MapBuffer ()"
Thank you very much ...
Preliminary results are strange, for dynamic update of vertices, using arrays of vertices is faster than using VBO. I suppose that by using arrays of vertices, the transfer by the graphics card is done by DMA (Direct Memory Access) and in the case of using VBO no DMA.
Simple Vertex Array: Average FPS = 113 Max.FPS = 102
VBO (BufferUsageHint.DynamicDraw): Average FPS = 55 Max.FPS = 101
Preliminary conclusion, using VBO is best when used with shader programs, otherwise use arrays of vertices.