Comments (8)
I was able to fix the error by replacing the cgo directives to use the MacOS equivalent import statements
replacing
// #include <GL/gl.h>
import "C"
with
// #cgo LDFLAGS: -framework Cocoa
// #cgo LDFLAGS: -framework OpenGL
// #cgo LDFLAGS: -framework IOKit
// #import <OpenGL/gl3.h>
import "C"
This reflects the differences in building OpenGL on MacOS compared to Linux/Windows.
I'm not happy with this solution yet, as it is messy and very specific to my version of MacOS.
I see that you include #cgo
directives in glfw/glfw3/glu, I'll try to find a minimal change which is idiomatic with the structure of your projects.
Also, FYI, it appears as though glfw3 uses Cocoa
and IOKit
on MacOS 10.8
http://stackoverflow.com/questions/18391487/compiling-with-glfw3-linker-errors-undefined-reference
from example.
Hi, thanks for taking the time to report this.
The trick may be to have the OSX definitions in a file separate to the linux ones and use conditional build flags.
http://golang.org/pkg/go/build/
i.e, a gl_darwin.go
file and a // +build !darwin
directive in the gl.go
. If you could find something which works for you and submit reports or pull requests to the specific projects, that would be great :)
from example.
Looks like someone has already made a fix:
Can you try master, does it work for you?
from example.
OS X 10.9.3 here, running go test
in examples/gl
results in this bizzare vertex shader syntax error. I checked out gl_test.go
, but couldn't find the problem.
I'm a bit of a newbie when it comes to OpenGL, but I'd be glad to help out in any way I can.
from example.
Hi I don't know if is related but when I try to run the triangle example I got this error on OS X 10.9.3
2014/07/11 14:51:10 Program validation failed: 0
panic: Program validation failed: 0
goroutine 1 [running]:
runtime.panic(0x4130100, 0xc21000a670)
/usr/local/Cellar/go/1.2.1/libexec/src/pkg/runtime/panic.c:266 +0xb6
log.Panic(0x4751dd8, 0x2, 0x2)
/usr/local/Cellar/go/1.2.1/libexec/src/pkg/log/log.go:307 +0xac
github.com/go-gl/glh.NewProgram(0x4751f10, 0x2, 0x2, 0x59)
/Users/3zcurdia/code/go/src/github.com/go-gl/glh/shader.go:40 +0x394
main.main()
/Users/3zcurdia/code/go/src/github.com/go-gl/examples/glfw3/triangle/triangle.go:79 +0x334
goroutine 3 [syscall]:
runtime.goexit()
/usr/local/Cellar/go/1.2.1/libexec/src/pkg/runtime/proc.c:1394
I the other hand the modern example runs without any trouble.
Any Help?
from example.
Hi, I'm on OSX Yosemite with homebrew install of glfw2
, glfw3
, glew
, 'sdl' & SDL_image
, which were all the dependencies. One of the tests is also failing (same as @lord I think). Below is the output:
go test
2015/01/31 13:14:45 === gltext/truetype
================================================================================
github.com/go-gl/examples/gltext/truetype
--------------------------------------------------------------------------------
2015/01/31 13:14:46 === mathgl/opengl-tutorial/objloader
================================================================================
github.com/go-gl/mathgl (download)
github.com/go-gl/mathgl/mgl32
github.com/go-gl/examples/mathgl/opengl-tutorial/objloader
--------------------------------------------------------------------------------
2015/01/31 13:14:51 === glfw3/modern
================================================================================
github.com/go-gl/examples/glfw3/modern
--------------------------------------------------------------------------------
2015/01/31 13:14:52 === nehe/06
================================================================================
github.com/go-gl/examples/nehe/06
--------------------------------------------------------------------------------
2015/01/31 13:14:54 === nehe/08
================================================================================
github.com/go-gl/examples/nehe/08
--------------------------------------------------------------------------------
2015/01/31 13:14:56 === nehe/03
================================================================================
github.com/go-gl/examples/nehe/03
--------------------------------------------------------------------------------
2015/01/31 13:15:02 === gl
================================================================================
-- subtest: gl
=== RUN TestTexImage1D
--- PASS: TestTexImage1D (0.63s)
=== RUN TestTexImage2D
--- PASS: TestTexImage2D (0.01s)
=== RUN TestTexImage3D
--- PASS: TestTexImage3D (0.02s)
=== RUN TestTexSubImage1D
--- PASS: TestTexSubImage1D (0.01s)
=== RUN TestTexSubImage2D
--- PASS: TestTexSubImage2D (0.02s)
=== RUN TestTexSubImage3D
--- PASS: TestTexSubImage3D (0.01s)
=== RUN TestBufferData
--- PASS: TestBufferData (0.03s)
=== RUN TestBufferSubData
--- PASS: TestBufferSubData (0.01s)
=== RUN TestGetBufferSubData
--- PASS: TestGetBufferSubData (0.02s)
=== RUN TestAttribPointer
panic: vertex shader error: ERROR: 0:2: 'foo' : syntax error: Array size must appear after variable name
goroutine 6 [running, locked to thread]:
github.com/go-gl/examples/gl.newProgram(0xc2080345c0)
/Users/Sam/src/github.com/go-gl/examples/gl/gl_test.go:273 +0x1be
github.com/go-gl/examples/gl.func·019()
/Users/Sam/src/github.com/go-gl/examples/gl/gl_test.go:300 +0x30
github.com/go-gl/testutils.func·001()
/Users/Sam/src/github.com/go-gl/testutils/gltest.go:53 +0x477
created by github.com/go-gl/testutils.StartOpenGL
/Users/Sam/src/github.com/go-gl/testutils/gltest.go:58 +0x25
goroutine 1 [chan receive, locked to thread]:
testing.RunTests(0x41c1cd8, 0x424b6a0, 0x14, 0x14, 0x4260501)
/usr/local/Cellar/go/1.4.1/libexec/src/testing/testing.go:556 +0xad6
testing.(*M).Run(0xc2080400f0, 0x424c3c0)
/usr/local/Cellar/go/1.4.1/libexec/src/testing/testing.go:485 +0x6c
main.main()
github.com/go-gl/examples/gl/_test/_testmain.go:90 +0x1d5
goroutine 15 [chan send]:
github.com/go-gl/testutils.OnTheMainThread(0xc20802a8a0, 0x41c1c48)
/Users/Sam/src/github.com/go-gl/testutils/gltest.go:27 +0x96
github.com/go-gl/examples/gl.TestAttribPointer(0xc20805e510)
/Users/Sam/src/github.com/go-gl/examples/gl/gl_test.go:315 +0x99
testing.tRunner(0xc20805e510, 0x424b778)
/usr/local/Cellar/go/1.4.1/libexec/src/testing/testing.go:447 +0xbf
created by testing.RunTests
/usr/local/Cellar/go/1.4.1/libexec/src/testing/testing.go:555 +0xa8b
goroutine 17 [syscall, locked to thread]:
runtime.goexit()
/usr/local/Cellar/go/1.4.1/libexec/src/runtime/asm_amd64.s:2232 +0x1
exit status 2
FAIL github.com/go-gl/examples/gl 0.800s
--- FAIL: TestExamples (18.64s)
examples_test.go:95: Process mathgl/opengl-tutorial/objloader died unexpectedly after 1.189658ms: "fork/exec bin/mathgl/opengl-tutorial/objloader: permission denied"
examples_test.go:39: Failed to run 'go test': exit status 1
FAIL
exit status 1
FAIL github.com/go-gl/examples 18.695s
from example.
Hi. I encountered the same problem as @3zcurdia's (see #28 (comment)) on OSX 10.10.2.
I moved some lines in examples/glfw3/triangle/triangle.go to avoid the problem like this.
// create & bind vertex array here
// OpenGL requires us to have a vertex array object bound
vertexArray := gl.GenVertexArray()
vertexArray.Bind()
vShader := glh.Shader{gl.VERTEX_SHADER, loadDataFile("triangle.v.glsl")}
fShader := glh.Shader{gl.FRAGMENT_SHADER, loadDataFile("triangle.f.glsl")}
program := glh.NewProgram(vShader, fShader)
program.Use()
I think glh.NewProgram() has 2 issues.
- It doesn't print program.GetInfoLog() message when gl.VALIDATE_STATUS is false.
- Is it appropriate to validate gl.Program here?
thanks.
from example.
I don't think this repository is well maintained. It has mostly one-off contributions, but little active updating from authors to keep it up with the latest changes.
Personally, I don't use glh
in any of my projects, so I can't know if it's no longer working.
from example.
Related Issues (20)
- how to convert glm to mgl32? HOT 1
- Build errors on Mac OS 10.11 HOT 9
- Improve unfriendly requirement that examples must be run in their package directory. HOT 2
- Go 1.6 -msan option error (memory sanitizer) HOT 6
- build error on OSX, go1.6 HOT 2
- [Question] Unable to run examples, only background windows showing in GL window HOT 4
- multiple contexts HOT 6
- Proposal: Rename repository to "example". HOT 6
- Specify permissive license. HOT 5
- Examples are broken HOT 1
- More information in examples HOT 2
- gl21-cube: Cube in demo appears squashed. HOT 6
- Odd choppiness to animation? HOT 8
- frame rate drops proportionally to number of process instances HOT 5
- Handle leak on Windows at SetSize? HOT 4
- fatal error: checkptr: unsafe pointer arithmetic on Go 1.14rc1 HOT 1
- Re: github.com/go-gl/example/gl41core-cube/cube.go HOT 1
- Can I render a webpage at the window HOT 1
- c:\go\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1 HOT 1
- gl.GenTextures
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from example.