flyx / OpenGLAda

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

Problem with GL.Objects.Buffers.Get_Sub_Data #81

Closed rogermc2 closed 6 years ago

rogermc2 commented 7 years ago

GL.Objects.Buffers.Get_Sub_Data implements glBufferSubData via API.Buffer_Sub_Data.

GL.API.Buffer_Sub_Data := Load_T107("glBufferSubData");

According to my reading, glBufferSubData "Replaces a subset of a buffer object's data store with new data" suggesting that Get_Sub_Data should be Set_Sub_Data or Load_Sub_Data. When I attempted to use Get_Sub_Data, compilation failed complaining that the target, GL_ARRAY_BUFFER, needs to be a variable. I managed to get my program to compile by deleting "in out" from "Target : in out Buffer_Target". This compares with the declaration for Load_To_Buffer. The line of code that I am trying to implement is:

 glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertices), vertices); 

As I still haven't been able to get my program to work, I'm not sure whether or not this is a problem.

flyx commented 7 years ago

I think you are right and this should be Set_Sub_Data. Also, I think the generics in GL.Objects.Buffers should removed and the methods should take a System.Address instead as with textures and Image_Source.

rogermc2 commented 7 years ago

OK. I've changed the name in my current branch to Set_Sub_Data. I also removed the "in out" from "Data : in out Pointers.Element_Array" as this seems to be input data. Although my program is not yet complete, it does compile and run to completion so I assume these changes are OK. I had a go at removing the generic but ran into problems. I can put more effort into it if you like. If so, is it just the Get_Sub_Data generic that needs to be removed or are there others?

flyx commented 6 years ago

This is long fixed, right? I don't find Get_Sub_Data anywhere in the code.

rogermc2 commented 6 years ago

OK.