flyx / OpenGLAda

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

Added some dynamic functions and Set_Vertex_Attrib_Pointer2 #131

Closed jokesin closed 5 years ago

jokesin commented 5 years ago

Added some dynamic functions and Set_Vertex_Attrib_Pointer2 Set_Vertex_Attrib_Pointer2 added in order to comfortable use offsets and other values in bytes, For example if we use Set_Buffer_Sub_Data, we need data in bytes, so we can use it further. Some code :

declare

        Block_Size    : Int := Get_Size(Vertex_Data.Vertex_Positions) + Get_Size(Vertex_Data.Vertex_Colors);
        Colour_Offset : Int := Get_Size(Vertex_Data.Vertex_Positions);

begin

        GL.Objects.Buffers.Allocate(Array_Buffer, Long(Block_Size),Static_Draw);
        Utilities.Set_Buffer_Sub_Data(Array_Buffer, 0, Vertex_Data.Vertex_Positions);
        Utilities.Set_Buffer_Sub_Data(Array_Buffer, Colour_Offset, Vertex_Data.Vertex_Colors);

        GL.Attributes.Set_Vertex_Attrib_Pointer2(vPosition, 4, Single_Type, 0, 0);
        GL.Attributes.Set_Vertex_Attrib_Pointer2(vColour, 4, Single_Type, 0, Colour_Offset);

end;

rogermc2 commented 5 years ago

Unfortunately Flyx has been silent for many months, so just when your extensive work might get merged seems unpredictable.

flyx commented 5 years ago

@rogermc2 Yes, I don't regularly check this project anymore, sorry. Thing is, I currently don't have an Ada development environment set up on my machines, which makes it difficult to help with error inquiries. However, I can still review PRs since wrapper code usually is easy enough to check without having to compile it.

rogermc2 commented 5 years ago

Great to hear that OpenGLAda is still supported.

jokesin commented 5 years ago

@flyx thanks for review!in the coming days I'll correct for the comments. I'll keep you informed.

flyx commented 5 years ago

Thanks!

Be aware that I squashed your commits, so if you want to continue working on your fork, you should force-update your develop from my develop. Create separate PR branches to avoid this in the future.

Semi-related: I might try and allocate some time on the weekend to release a new OpenGLAda version since GNAT Community requires the -gnat12 switch, so your changes may find their way into an release rather quickly. If you have plans to add more stuff, please tell me so I can plan ahead :).

jokesin commented 5 years ago

Thanks,Felix! Ok, I'll take your adviсe. This time i have no any more stuff to add)

Вторник, 5 марта 2019, 21:42 +03:00 от flyx notifications@github.com:

Thanks! Be aware that I squashed your commits, so if you want to continue working on your fork, you should force-update your develop from my develop. Create separate PR branches to avoid this in the future. Semi-related: I might try and allocate some time on the weekend to release a new OpenGLAda version since GNAT Community requires the -gnat12 switch, so your changes may find their way into an release rather quickly. If you have plans to add more stuff, please tell me so I can plan ahead :). — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub , or mute the thread .


С уважением, Георгий

rogermc2 commented 5 years ago

I've just pulled the latest. gl-text.abd compilation produces a warning that GL.Attributes.Set_Vertex_Attrib_Pointer is deprecated. Should I now update gl-text.abd and any other obsolescent procedures that I find to the newer versions?

flyx commented 5 years ago

@rogermc2 I'm taking care of upgrading all the references to that procedure, including in the examples.

rogermc2 commented 5 years ago

Thanks

flyx commented 5 years ago

@jokesin I removed your Draw_Arrays_Instanced from GL.Objects.Buffers because it was already defined in GL.Objects.Vertex_Arrays. I also renamed Primitive_Restart_Index to Set_Primitive_Restart_Index (to conform with naming of similar procedures) and moved it to GL.Objects.Vertex_Arrays since it belongs with the other functions.

glDrawArraysInstanced does not necessarily require vertex arrays, but my understanding is that this is the modern way to use it and therefore it belongs to GL.Objects.Vertex_Arrays. I may be wrong here.