2018-02-22 23:33

如何使用openGL的golang绑定定义gl.DrawBuffers COLOR_ATTACHMENTi

  • opengl
  • framebuffer

Using "github.com/go-gl/gl/v4.5-core/gl" the golang bindings for setting the array of color_attachments is as follows:

// Specifies a list of color buffers to be drawn into
func DrawBuffers(n int32, bufs *uint32) {
    C.glowDrawBuffers(gpDrawBuffers, (C.GLsizei)(n), (*C.GLenum)(unsafe.Pointer(bufs)))

In c++ you would do this like:

// Set "renderedTexture" as our colour attachement #0
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, renderedTexture, 0);

// Set the list of draw buffers.
GLenum DrawBuffers[1] = {GL_COLOR_ATTACHMENT0};
glDrawBuffers(1, DrawBuffers); // "1" is the size of DrawBuffers

I can't for the life of me figure out how you are expected to pass an array of buffers to this and any help would be appreciated.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答