kvark's picture

[GL] Remove DawElements overload with Integer last parameter

Project:The Open Toolkit library
Category:support request

The GL.DrawElements method has an overload with the last parameter of type Integer. It is very confusing, because you expect it to be the number of elements to skip, but instead you get a byte offset.


Comment viewing options

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


Status:open» postponed

The last parameter of DrawElements is indeed overloaded to mean either "array of elements" or "byte offset" depending on use (Vertex Arrays vs Vertex Buffer Objects). This is the official OpenGL design, not something specific to OpenTK.

The int overload was added during the Tao framework era when the last parameter was either object or IntPtr (no generics then). Many people would pass integers when they meant IntPtr, which would invoke the object overload and promptly crash the application.

It's too late to remove the int overload now (backwards compatibility) but this could be revisited in a future, API-breaking release.

kvark's picture


Ok, thanks for the clarification!