Hacker News new | ask | show | jobs
by aconz2 3813 days ago
This only seems useful for user-defined glsl types. The builtin glsl types would only have to be written out once as D types.

The general idea of "importing" types is a good one and I think this is what F# achieves with type providers. I've seen this applied to database schemas and filesystems, but never OpenGL.

1 comments

Maybe its because OpenTK has type safe bindings(OpenGL, OpenCL and OpenAL) for F# and C#.. http://www.opentk.com/
It took an awesome amount of work to get that level of type-safety. Now that this is in place, other languages could use that infrastructure to provide type-safe bindings:

https://github.com/opentk/opentk/tree/develop/Source/Bind/Sp...

The */override.xml files contain directives to convert the official Khronos XML specifications into type-safe versions. All you need is a code generator for your language of choice.

If anyone is interested in trying this, I encourage you to contact the developers on github (there used to be C++ and Java code generators that have since been removed.)

>there used to be C++ and Java code generators that have since been removed.

What was the reason for removal? Difficulty of maintenance? Out of scope for a C# project?

Mainly lack of an interested maintainer.

It's also a bit tricky because some .Net assumptions are hardcoded (i.e. overload resolution, generics, pointers+references), which makes it harder to generate idiomatic code for other languages. Nothing that cannot be fixed with a bit of effort if someone interested shows up, but until then it's better to generate excellent bindings for one runtime than mediocre bindings for multiple (and pretty much every runtime comes with a mediocre OpenGL binding.)