c# - Converting gl.MapBuffer to struct throws System.MissingMethodException Exception -


i need cast gl.mapbuffer struct vertexdata throws error

public struct vertexdata {     public vector3 vertex;     public vector4 color;  }  public override void submit(renderable2d renderable) {         gl.bindbuffer(opengl.gl_array_buffer, _vbo);         _buffer = (vertexdata[])marshal.ptrtostructure(gl.mapbuffer(opengl.gl_array_buffer, opengl.gl_write_only), typeof(vertexdata[]));         vector3 position = renderable.getposition();         vector2 size = renderable.getsize();         vector4 color = renderable.getcolor();                      _buffer[0].vertex = position;         _buffer[0].color = color;          _buffer[1].vertex = new vector3(position.x, position.y + size.y, position.z);         _buffer[1].color = color;          _buffer[2].vertex = new vector3(position.x + size.x, position.y + size.y, position.z);         _buffer[2].color = color;          _buffer[3].vertex = new vector3(position.x + size.x, position.y, position.z);         _buffer[3].color = color; } 

the following line throws system.missingmethodexception exception

_buffer = (vertexdata[])marshal.ptrtostructure(gl.mapbuffer(opengl.gl_array_buffer, opengl.gl_write_only), typeof(vertexdata[])); 


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -