Giter Club home page Giter Club logo

Comments (8)

GlenKelley avatar GlenKelley commented on July 17, 2024

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.

pwaller avatar pwaller commented on July 17, 2024

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.

pwaller avatar pwaller commented on July 17, 2024

Looks like someone has already made a fix:

go-gl/glfw@8d77f5e

Can you try master, does it work for you?

from example.

lord avatar lord commented on July 17, 2024

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.

3zcurdia avatar 3zcurdia commented on July 17, 2024

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.

SamMorrowDrums avatar SamMorrowDrums commented on July 17, 2024

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.

andcode365 avatar andcode365 commented on July 17, 2024

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.

  1. It doesn't print program.GetInfoLog() message when gl.VALIDATE_STATUS is false.
  2. Is it appropriate to validate gl.Program here?

thanks.

from example.

dmitshur avatar dmitshur commented on July 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.