go-gl-legacy / gl

Go bindings for OpenGL
BSD 3-Clause "New" or "Revised" License
342 stars 52 forks source link

gl.BindFramebuffer missing #125

Closed nergdron closed 11 years ago

nergdron commented 11 years ago

glBindFramebuffer seems to be missing from these bindings. There is a generic Buffer.Bind() function, but internally it uses glBindBuffer, and so passing in valid enums for glBindFramebuffer just results in a GL_INVALID_ENUM error.

http://www.opengl.org/sdk/docs/man/xhtml/glBindFramebuffer.xml

I need glBindFramebuffer so I can use gl.BlitFramebuffer, which does have bindings here, but doesn't work properly without being able to bind separate gl.READ_FRAMEBUFFER and gl.WRITE_FRAMEBUFFER.

pakanek commented 11 years ago

Try 'func (fb Framebuffer) BindTarget(target GLenum)' instead (https://github.com/go-gl/gl/issues/113). Bind() method doesn't reflect functionality of glBindBuffer since it sets target to GL_FRAMEBUFFER. Don't know why it is implemented this way. However this could be fixed by adding target parameter to Bind() method and replacing it in old code with Bind(gl.FRAMEBUFFER).

nergdron commented 11 years ago

Hmmm, I had an older checkout of go-gl/gl that didn't have this function. It looks like it'll require a patch to use with glh.Framebuffer, but it's what I was after. Thanks for the tip!

pwaller commented 11 years ago

@pakanek In answer to your question, I think it was a mistake in the original bindings that it was hard coded and not a parameter. We're going to some lengths to maintain API compatibility so we can't just add another parameter - that would break code in the wild which uses it. Hence the new function.