go-gl / gl

Go bindings for OpenGL (generated via glow)
MIT License
1.06k stars 72 forks source link

Why `UniformMatrix3fv` accepts only a *float32? #121

Closed inkeliz closed 4 years ago

inkeliz commented 4 years ago

First, I don't understand OpenGL to much, I'm learning about it.

There's a function UniformMatrix3fv:

func UniformMatrix3fv(location int32, count int32, transpose bool, value *float32) {
    C.glowUniformMatrix3fv(gpUniformMatrix3fv, (C.GLint)(location), (C.GLsizei)(count), (C.GLboolean)(boolToInt(transpose)), (*C.GLfloat)(unsafe.Pointer(value)))
}

However, that function is supposed to accept a array, as a value of value, as described here. I think there's no diference between WebGL and OpenGL.


But the current UniformMatrix3fv accepts *float32, not a []float32. What value is supposed to supply? If I use &myarray[0] is enough?

jeff-emanuel commented 4 years ago

Yes, pass &myarray[0]. OpenGL is not WebGL. See https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glUniform.xhtml instead.

On Mon, Jan 6, 2020 at 6:58 AM Inkeliz notifications@github.com wrote:

First, I don't understand OpenGL to much, I'm learning about it.

There's a function UniformMatrix3fv:

func UniformMatrix3fv(location int32, count int32, transpose bool, value float32) { C.glowUniformMatrix3fv(gpUniformMatrix3fv, (C.GLint)(location), (C.GLsizei)(count), (C.GLboolean)(boolToInt(transpose)), (C.GLfloat)(unsafe.Pointer(value))) }

However, that function is supposed to accept a array, as a value of value, as described here https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniformMatrix. I think there's no diference between WebGL and OpenGL.

But the current UniformMatrix3fv accepts *float32, not a []float32. What value is supposed to supply? If I use &myarray[0] is enough?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/go-gl/gl/issues/121?email_source=notifications&email_token=AIMEUJ6WU5R7O644MHD3ALDQ4M2J7A5CNFSM4KDEWVMKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IEHLARQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIMEUJ55H4LXF7XE4WDHNDLQ4M2J7ANCNFSM4KDEWVMA .