Go-gl on Virtualbox?

172 views
Skip to first unread message

Jonathan Barnard

unread,
Jul 21, 2014, 9:31:08 AM7/21/14
to go...@googlegroups.com
I recently tested Go-gl (github.com/chsc/gogl/gl21) on an Arch Linux Virtualbox client, and gl.Init() fails with "unable to initialize VERSION_1_5". I know the program isn't faulty, as it works on a standard Linux boot. I also know it's possible to use OpenGL on that Virtualbox install, as a similar C program using glewInit() works fine. So I just thought I'd mention it here in case it's a bug of some sort.

The code that produces the error:

import (
    "fmt"
    gl "github.com/chsc/gogl/gl21"
    glfw "github.com/go-gl/glfw3"
)

func errorCallback(err glfw.ErrorCode, desc string) {
    fmt.Printf("%v: %v\n", err, desc)
}

func main() {
    glfw.SetErrorCallback(errorCallback)
    if !glfw.Init() {
        panic("Can't init glfw!")
    }
    defer glfw.Terminate()
    glfw.WindowHint(glfw.Samples, 2)
    glfw.WindowHint(glfw.ContextVersionMajor, 2)
    glfw.WindowHint(glfw.ContextVersionMinor, 1)
    window, err := glfw.CreateWindow(800, 600, "Titanic", nil, nil)
    if err != nil {
        panic(err)
    }
    window.MakeContextCurrent()
    if err := gl.Init(); err != nil{
        panic(err)
    }
}


The following warnings are emitted (note that the C version using GLEW also emits these warnings but works fine):

libGL error: pci id for fd 4: 80ee:beef, driver (null)
OpenGL Warning: glFlushVertexArrayRangeNV not found in mesa table
OpenGL Warning: glVertexArrayRangeNV not found in mesa table
OpenGL Warning: glCombinerInputNV not found in mesa table
OpenGL Warning: glCombinerOutputNV not found in mesa table
OpenGL Warning: glCombinerParameterfNV not found in mesa table
OpenGL Warning: glCombinerParameterfvNV not found in mesa table
OpenGL Warning: glCombinerParameteriNV not found in mesa table
OpenGL Warning: glCombinerParameterivNV not found in mesa table
OpenGL Warning: glFinalCombinerInputNV not found in mesa table
OpenGL Warning: glGetCombinerInputParameterfvNV not found in mesa table
OpenGL Warning: glGetCombinerInputParameterivNV not found in mesa table
OpenGL Warning: glGetCombinerOutputParameterfvNV not found in mesa table
OpenGL Warning: glGetCombinerOutputParameterivNV not found in mesa table
OpenGL Warning: glGetFinalCombinerInputParameterfvNV not found in mesa table
OpenGL Warning: glGetFinalCombinerInputParameterivNV not found in mesa table
OpenGL Warning: glDeleteFencesNV not found in mesa table
OpenGL Warning: glFinishFenceNV not found in mesa table
OpenGL Warning: glGenFencesNV not found in mesa table
OpenGL Warning: glGetFenceivNV not found in mesa table
OpenGL Warning: glIsFenceNV not found in mesa table
OpenGL Warning: glSetFenceNV not found in mesa table
OpenGL Warning: glTestFenceNV not found in mesa table
libGL error: core dri or dri2 extension not found
libGL error: failed to load driver: vboxvideo

Dmitri Shuralyov

unread,
Aug 1, 2014, 10:16:43 AM8/1/14
to go...@googlegroups.com
What happens if you replace it with this code:

    if !glfw.Init() {
        log.Println("Error while init glfw, but continuing anyway...")
    }

That would be the first thing I try before investigating further. There were times I had to do similar things, e.g., when importing gl33 on previous version of OS X that only supported GL 3.2.

Jonathan Barnard

unread,
Aug 1, 2014, 10:28:28 PM8/1/14
to Dmitri Shuralyov, go...@googlegroups.com
Then when trying gl.GenBuffers it panics with the following output:

fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0x0 pc=0x0]

runtime stack:
runtime: unexpected return pc for runtime.asmcgocall called from 0x0
runtime.throw(0x78bb45)
    /usr/lib/go/src/pkg/runtime/panic.c:520 +0x69
runtime.sigpanic()
    /usr/lib/go/src/pkg/runtime/os_linux.c:222 +0x3d
runtime: unexpected return pc for runtime.asmcgocall called from 0x0
runtime.asmcgocall(0x0, 0x0)
    /usr/lib/go/src/pkg/runtime/asm_amd64.s:709 +0x61

goroutine 16 [syscall]:
runtime.cgocall(0x422ef0, 0x7f63ba54ce90)
    /usr/lib/go/src/pkg/runtime/cgocall.c:143 +0xe5 fp=0x7f63ba54ce78 sp=0x7f63ba54ce30
github.com/chsc/gogl/gl21._Cfunc_goglGenBuffers(0x1, 0xc208000150)
    github.com/chsc/gogl/gl21/_obj/_cgo_defun.c:1394 +0x31 fp=0x7f63ba54ce90 sp=0x7f63ba54ce78
github.com/chsc/gogl/gl21.GenBuffers(0x1, 0xc208000150)
    /home/jonathan/go/src/github.com/chsc/gogl/gl21/gl21.go:6558 +0x2f fp=0x7f63ba54cea8 sp=0x7f63ba54ce90
main.main()
    /home/jonathan/projects/ParticleBench/tmp.go:32 +0x251 fp=0x7f63ba54cf50 sp=0x7f63ba54cea8
runtime.main()
    /usr/lib/go/src/pkg/runtime/proc.c:247 +0x11a fp=0x7f63ba54cfa8 sp=0x7f63ba54cf50
runtime.goexit()
    /usr/lib/go/src/pkg/runtime/proc.c:1445 fp=0x7f63ba54cfb0 sp=0x7f63ba54cfa8
created by _rt0_go
    /usr/lib/go/src/pkg/runtime/asm_amd64.s:97 +0x120

goroutine 19 [finalizer wait]:
runtime.park(0x438990, 0x7914b8, 0x78e729)
    /usr/lib/go/src/pkg/runtime/proc.c:1369 +0x89
runtime.parkunlock(0x7914b8, 0x78e729)
    /usr/lib/go/src/pkg/runtime/proc.c:1385 +0x3b
runfinq()
    /usr/lib/go/src/pkg/runtime/mgc0.c:2644 +0xcf
runtime.goexit()
    /usr/lib/go/src/pkg/runtime/proc.c:1445

goroutine 17 [syscall]:
runtime.goexit()
    /usr/lib/go/src/pkg/runtime/proc.c:1445
exit status 2


--
You received this message because you are subscribed to a topic in the Google Groups "go-gl OpenGL libraries for go" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/go-gl/-_svXZ5-wZM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to go-gl+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dmitri Shuralyov

unread,
Aug 1, 2014, 10:36:14 PM8/1/14
to go...@googlegroups.com
Err, I made a mistake above, what I meant to say was:

if err := gl.Init(); err != nil {

log.Println("Error while init gl (not glfw), but continuing anyway:", err)
}

Seeing addr=0x0 on gl calls means the funcs are really not initialized to non-nil values.

Reply all
Reply to author
Forward
0 new messages