Closed neclepsio closed 9 years ago
Please see the documentation of the function:
http://gopkg.in/qml.v1/gl/2.0#GL.VertexAttribPointer
The short version is that providing a buffer to VertexAttrbPointer is deprecated. The modern way to do this is via GenBuffer+BindBuffer+BufferData. The painting-es2 example uses it:
https://github.com/go-qml/qml/blob/v1/examples/painting-es2/painting.go
Regarding point 2, I disagree. Using []byte is idiomatic and prevents a copy.
It's ok it's deprecated in you api, but if I still want to use it, is int(uintptr(unsafe.Pointer(&slice[0]))) the way to go? Can int(uintptr) overflow/underflow, for example? Il 06/set/2014 00:46 "Gustavo Niemeyer" notifications@github.com ha scritto:
Please see the documentation of the function:
http://gopkg.in/qml.v1/gl/2.0#GL.VertexAttribPointer
The short version is that providing a buffer to VertexAttrbPointer is deprecated. The modern way to do this is via GenBuffer+BindBuffer+BufferData. The painting-es2 example uses it:
https://github.com/go-qml/qml/blob/v1/examples/painting-es2/painting.go
Regarding point 2, I disagree. Using []byte is idiomatic and prevents a copy.
— Reply to this email directly or view it on GitHub https://github.com/go-qml/qml/issues/93#issuecomment-54690928.
I meant that my understanding is that the use of the pointer attribute to provide an array is obsoleted in OpenGL in general.
That said, I'd like to support your use of it, if you really want to, and there's no good way to do that while the parameter is an int, because it may not necessarily be sized after the machine word size (although it generally is, right now).
To fix that problem, I'll convert the offset type into a "uintptr", so that the proper way to do what you want would be:
uintptr(unsafe.Pointer(&slice[0]))
That said, I'd still encourage you to provide the array as buffer data instead.
There are some issues with OpenGL wrapper.
(I'm not sure int(uintptr(...)) is correct)
Thank you Ignazio