About a year ago, I started poking at OpenGL because it is was something I'd 
never done. I realized that a lot of it made my skin tingle because of how much 
it lacked type safety. So much of it seems to depend on arbitrary hand waving 
-- calling methods in the right order, using the correct data types, knowing 
what constants apply in various situations. But, obviously, adding abstractions 
usually adds overhead. So I started an experiment with macros to see if I could 
make OpenGL more type safe with minimal overhead.

  * Uses Enums instead of arbitrary constants
  * Distinct types for all IDs
  * Uses macros to automatically bind Nim objects into things like Vertex 
Buffers and Uniforms
  * Basic texture loading methods
  * Abstraction for compiling and using shaders
  * Wrappers around anything delicate -- like initialization



Basically, my goal is to make it a Nim compile error if anything would cause 
your OpenGL code not to work.

Then my wife had a baby and things got busy. Fast forward a year and I'm 
picking it back up. But I decided I needed some feedback. While I've been in 
the industry for many years, I'm not really an expert in graphics programming 
-- which makes me a bad judge of whether this is actually headed in the right 
direction. So I suppose I'm interested in getting some constructive feedback.

The code: 
[https://github.com/Nycto/safegl-nim](https://github.com/Nycto/safegl-nim)

Docs: 
[https://nycto.github.io/safegl-nim/safegl.html](https://nycto.github.io/safegl-nim/safegl.html)

And an example: 
[https://github.com/Nycto/safegl-nim/blob/master/example/src/example.nim](https://github.com/Nycto/safegl-nim/blob/master/example/src/example.nim)

Reply via email to