darxus's picture

GL types vs dotNET types

I just implement some OpenGL tutorials in OpenTK for the moment. I see that most of these tutorials use custom types that exist in OpenGL (or C++). For example: GLfloat, GLuint...

Are there any use of these types in OpenTK? Or they are compatible with dotNET in sake of simplicity?



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler.'s picture

The only reason these types exist, is because C doesn't guarantee how many bits an 'int' is (in OpenGL 'GLint' is guaranteed to be 32bits wide). Since C# defines its types exactly, there's no use for the GLxxx types:

  • GLshort -> short
  • GLushort -> ushort
  • GLint -> int
  • GLsizeiptr -> IntPtr

you get the idea (the file 'csharp.tm' contains the complete typemap - found in Source/Bind/Specifications)


darxus's picture

Cool, thanks again Fiddler.