Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad equation argument for gl.ClipPlane #157

Closed
tildeleb opened this issue Jun 29, 2014 · 3 comments
Closed

Bad equation argument for gl.ClipPlane #157

tildeleb opened this issue Jun 29, 2014 · 3 comments

Comments

@tildeleb
Copy link
Contributor

For the function ClipPlane the equation argument doesn't look like it was translated correctly from C.

It is:

    //void glClipPlane (GLenum plane, const float64 *equation)
    func ClipPlane(plane GLenum, equation *float64) {
        C.glClipPlane(C.GLenum(plane), (*C.GLdouble)(equation))
}

I would prefer to change it to:

    //void glClipPlane (GLenum plane, const float64 *equation)
    func ClipPlane(plane GLenum, equation []float64) {
        C.glClipPlane(C.GLenum(plane), (*C.GLdouble)(&equation[0))

which is similar to current Materialfv call but I could also change it to use a type of similar to the one used for:

//void glNormal3dv (const float64 *v)
func Normal3dv(v *[3]float64) {
    C.glNormal3dv((*C.GLdouble)(&v[0]))
}

I think it would be best if go-gl was consistant with typing. I much prefer the slice over the array. Anyone have any opinions on which type would be best?

Over the long term how do we resolve differences in typing?

leb

@UserAB1236872
Copy link
Contributor

This is definitely wrong, since it wants 4 floats.

The slice is definitely better than an array. The reason is that it's trivial to go from an array to a slice (array[:]) but difficult to go from a slice to an array (requires unsafe or a copy). The only question is whether we want to bounds check the slice, I'd prefer not, but it's not a huge deal either way.

@UserAB1236872
Copy link
Contributor

Oh, I see this issue was already mentioned:

go-gl/gl#154

@pwaller
Copy link
Contributor

pwaller commented Jun 30, 2014

Let's close this as a dupe of #154 and continue discussion there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants