dousi1961 2016-05-03 12:13
浏览 210
已采纳

glEnableVertexArrayAttrib生成的段错误

I'm writing a simple OpenGL program using go-gl. While the program runs fine on most machines, it fails with a segfault when running under Windows on my laptop (it works on Linux though - this is what's odd about it). The culprit is my call to glEnableVertexArrayAttrib. I've attached the stack trace and relevant code below.

Partial stack trace:

Exception 0xc0000005 0x8 0x0 0x0
PC=0x0
signal arrived during external code execution

github.com/go-gl/gl/v3.3-core/gl._Cfunc_glowEnableVertexArrayAttrib(0x0, 0x1)
    github.com/go-gl/gl/v3.3-core/gl/_obj/_cgo_gotypes.go:4141 +0x41
github.com/go-gl/gl/v3.3-core/gl.EnableVertexArrayAttrib(0x1)
    C:/Users/mpron/go/src/github.com/go-gl/gl/v3.3-core/gl/package.go:5874 +0x3a
github.com/caseif/cubic-go/graphics.prepareVbo(0x1, 0xc0820086e0, 0xc0820a7e70)
    C:/Users/mpron/go/src/github.com/caseif/cubic-go/graphics/block_renderer.go:145 +0x108

Relevant code:

gl.GenVertexArrays(1, &vaoHandle)
gl.BindVertexArray(vaoHandle)
gl.BindBuffer(gl.ARRAY_BUFFER, handle)
gl.BufferData(gl.ARRAY_BUFFER, len(*vbo) * 4, gl.Ptr(*vbo), gl.STATIC_DRAW)
gl.EnableVertexArrayAttrib(vaoHandle, positionAttrIndex) // line 145
gl.VertexAttribPointer(positionAttrIndex, 3, gl.FLOAT, false, 12, nil)
  • 写回答

1条回答 默认 最新

  • dqsong2010 2016-05-03 13:16
    关注

    I made a subtle mistake in calling glEnableVertexArrayAttrib, only available since OpenGL 4.5, instead of glEnableVertexAttribArray, which is available since OpenGL 2.1. The former function allows attribute arrays to be toggled on a per-VAO basis, which isn't at all necessary in this context.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 c语言写的8051单片机存储器mt29的模块程序
  • ¥60 求直线方程 使平面上n个点在直线同侧并且距离总和最小
  • ¥50 java算法,给定试题的难度数量(简单,普通,困难),和试题类型数量(单选,多选,判断),以及题库中各种类型的题有多少道,求能否随机抽题。
  • ¥50 rk3588板端推理
  • ¥250 opencv怎么去掉 数字0中间的斜杠。
  • ¥15 这种情况的伯德图和奈奎斯特曲线怎么分析?
  • ¥250 paddleocr带斜线的0很容易识别成9
  • ¥15 电子档案元素采集(tiff及PDF扫描图片)
  • ¥15 flink-sql-connector-rabbitmq使用
  • ¥15 zynq7015,PCIE读写延时偏大