flyx / OpenGLAda

Thick Ada binding for OpenGL and GLFW
flyx.github.io/OpenGLAda/
MIT License
95 stars 13 forks source link

Math utiliy enhancement. #60

Closed rogermc2 closed 7 years ago

rogermc2 commented 7 years ago

Add print 3D vector and print OpenGL 1D array procedures. Make Maths.Single_Math_Functions package visible as it is needed for many examples.

flyx commented 7 years ago

Frankly, I don't really understand why I require an instantiation of Interfaces.C.Pointers for Load_To_Buffer. Its implementation only uses the Element and Element_Array types from it, so I could just require those two types as generic parameters.

I wonder if it's too late to change that.

rogermc2 commented 7 years ago

If you need to change the implementation, its not too late from my point of view. Is there something that I need to do?

flyx commented 7 years ago

Well, what I'd like to do is to change

generic
   with package Pointers is new Interfaces.C.Pointers (<>);
procedure Load_To_Buffer (Target : Buffer_Target;
                          Data   : Pointers.Element_Array;
                          Usage  : Buffer_Usage);

to:

generic
   type Index is (<>);
   type Element is private;
   type Element_Array is array (Index range <>) of aliased Element;
procedure Load_To_Buffer (Target : Buffer_Target;
                          Data   : Element_Array;
                          Usage  : Buffer_Usage);

This would break all existing code that uses it, including a lot of your examples, which would need to be fixed.

rogermc2 commented 7 years ago

That's OK. I'm happy to fix things for the sake of overall improvement.

rogermc2 commented 7 years ago

I'm replacing this PR by a quaternian implementation PR which incorporates these and other changes.