
Problem with VBO Rendering - memory corruption
Posted Monday, 7 June, 2010 - 04:01 by ssarangi inHi All,
I have been trying to render a mesh using VBO's however, it crashes saying internally the memory has been corrupted. I have worked with VBO's in C and they had worked fine so there is definitely something I am missing here. I have been working for hours on this to no avail. I would really appreciate the help if someone could take a quick look at the code I am posting.
Using an immediate mode technique works and its commented out right now just below the VBO code. The main code for this is in the mesh.cs file with the render method.
The link for the code is here : http://www.megaupload.com/?d=M61HDK7J
I would again... really really appreciate any help with this.
Thanks,
Satyajit
Ps: The filename should be changed from buddha_res4.ply to buddha.ply


Comments
Re: Problem with VBO Rendering - memory corruption
The filename which is being loaded should be changed from buddha_res4.ply to buddha.ply
Re: Problem with VBO Rendering - memory corruption
In Mesh.cs:
GL.BindBuffer(BufferTarget.ElementArrayBuffer, index_vbo)call)GL.DrawElements().Re: Problem with VBO Rendering - memory corruption
Thanks a lot Fiddler. That works... Thanks for pointing out the structure vs class difference for Vector3f methods.
However, I have a general question which might be due to my ignorance but somehow C# doesn't allow me to write extension methods for structures ( i.e. say for the current Vector3 implementation of OpenTK).
The way I was doing it was to use something like this...
publlic static vector_methods(this Vector3 v)
{
// Do Something
}
Is this allowed for structures or does it work only with classes ?
Thanks.....
Satyajit
Ps: I really think OpenTK is a very comfortable API to work with... :)
Re: Problem with VBO Rendering - memory corruption
This should work:
I've been using this pattern extensively, it's very useful.
The only limitation is that you have to return a new Vector3 instance (or "v"). Any changes you make to "v" above won't be reflected back to the original structure by default (your changes affect a copy, not the original structure - that's another difference between value types and classes).