Open tod91 opened 2 years ago
Does the gl41core-cube
example program run okay for you?
If so, it has similar code, so you can try to spot what it's doing differently that allows it to work.
@tod91 (It's more than a year ago you asked, but adding a solution in case some else has this issue.)
Check that you import the correct gl
package. The gl package includes many different (generated) packages, one for each important OpenGL version (generated by Glow). It's easy for your IDE/go fmt
to import the wrong, ie. for example github.com/go-gl/gl/all-core/gl
when you need for example github.com/go-gl/gl/v4.1-core/gl
on MacOS (other OS might require other specific GL versions). This is especially true if your OpenGL code is spread over multiple file. Check that they all use the correct imports.
Check that you import the correct
gl
package
ughh. I had trouble loading textures and kept getting seg faults. This was my issue. Unrelated to this OP's ticket, but did save me! I'll try to remember this in the future!
Hello I'm having issues generating an vertex buffer.
I have a very simple Shader struct as so
type Shader struct { vbo uint32 }
which I try to use in a generate in a separate function as so:
func NewShader() Shader { sh := &Shader{vbo: 0} gl.GenBuffers(1, &sh.vbo) gl.BindBuffer(gl.ARRAY_BUFFER, sh.vbo) gl.BufferData(gl.ARRAY_BUFFER, len(vertices)4, gl.Ptr(vertices), gl.STATIC_DRAW) return sh }
however I get a panic bad access: nil dereference.
I initialize the OpenGL binding in a separate init() function.
Any help would be greatly appreciated.