
Problem with Custom class for VBO's
Posted Monday, 7 June, 2010 - 01:25 by ssarangi inHi all,
I am trying to use a custom Vertex and Triangle class for the Vertex buffer objects however I get the error message that "The type 'GLUtils.MathUtils.Vector3f' must be a non-nullable value type in order to use it as parameter 'T2' in the generic type".
I think I am missing something simple but Vertex3f has been defined as a class and not a struct explicitly so as to allow me to extend it later by writing extension methods which I really miss with the original Vector implementation.
So assuming that I do need to use a custom class instead of the Vector3 of OpenTK, is there a way to make my class forced to be a non-nullable type ?
Thanks,
Satyajit


Comments
Re: Problem with Custom class for VBO's
Classes contain extra information for internal use by the .Net runtime, which would cause corruption in OpenGL. This is why OpenTK asks for a value (non-nullable) type.
What you can do is make Vector3f a struct and extend it with extension methods. Take a look for Mono.SIMD for a concrete example of Vector3f implemented this way.