GithubHelp home page GithubHelp logo

ponzi2 on macOS about ponzi2 HOT 13 OPEN

abhobe avatar abhobe commented on August 26, 2024
ponzi2 on macOS

from ponzi2.

Comments (13)

btmura avatar btmura commented on August 26, 2024

Hi abhobe,

I've got a couple ideas you can try. If one of them works, let me know. Maybe we're requesting too high of a version.

  1. Remove that line altogether and see if it works.

  2. Try changing 5 to 1 in ui.go and see if it works:

glfw.WindowHint(glfw.ContextVersionMinor, 5)

https://github.com/btmura/ponzi2/blob/master/internal/app/view/ui/ui.go#L199

  1. In addition to line 2, change the imports from:

"github.com/go-gl/gl/v4.5-core/gl"

to:

"github.com/go-gl/gl/v4.1-core/gl"

from ponzi2.

abhobe avatar abhobe commented on August 26, 2024

Hi Brian,

I did what you said, but I'm not sure how to compile it into a binary. I ran go generate ./... but that didn't do anything.

from ponzi2.

btmura avatar btmura commented on August 26, 2024

Can you try this command within the top directory?

go build ./cmd/ponzi2

from ponzi2.

abhobe avatar abhobe commented on August 26, 2024

The binary built, but the execution gave off an error.

 18:51:27 ui.go:225 OpenGL version: 4.1 ATI-4.2.15
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x0]

runtime stack:
runtime.throw(0x44225d1, 0x2a)
	/usr/local/Cellar/go/1.16/libexec/src/runtime/panic.go:1117 +0x72
runtime.sigpanic()
	/usr/local/Cellar/go/1.16/libexec/src/runtime/signal_unix.go:718 +0x2ef

goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x4359150, 0xc000425b68, 0x64)
	/usr/local/Cellar/go/1.16/libexec/src/runtime/cgocall.go:154 +0x5b fp=0xc000425b38 sp=0xc000425b00 pc=0x4007bbb
github.com/go-gl/gl/v4.5-core/gl._Cfunc_glowCreateShader(0x0, 0x8b31, 0x0)
	_cgo_gotypes.go:5453 +0x48 fp=0xc000425b68 sp=0xc000425b38 pc=0x429b748
github.com/go-gl/gl/v4.5-core/gl.CreateShader(...)
	/Users/abhobe/go/pkg/mod/github.com/go-gl/[email protected]/v4.5-core/gl/package.go:9106
github.com/btmura/ponzi2/internal/app/gfx.glShader(0xc000472000, 0x191, 0x8b31, 0x0, 0x0, 0x0)
	/Users/abhobe/ponzi2/internal/app/gfx/gl.go:50 +0x75 fp=0xc000425c50 sp=0xc000425b68 pc=0x42c0795
github.com/btmura/ponzi2/internal/app/gfx.glProgram(0xc000472000, 0x191, 0xc00011e000, 0x2a3, 0x0, 0x0, 0x0)
	/Users/abhobe/ponzi2/internal/app/gfx/gl.go:14 +0x7b fp=0xc000425d00 sp=0xc000425c50 pc=0x42c02bb
github.com/btmura/ponzi2/internal/app/gfx.InitProgram(0x7fff6cc3aeed, 0x0)
	/Users/abhobe/ponzi2/internal/app/gfx/gfx.go:42 +0x9d fp=0xc000425d60 sp=0xc000425d00 pc=0x42bf57d
github.com/btmura/ponzi2/internal/app/view/ui.(*UI).Init(0xc000408c30, 0x450c0f0, 0xc0000b8010, 0xc0000de101, 0xc00041a200, 0xc000425e90)
	/Users/abhobe/ponzi2/internal/app/view/ui/ui.go:231 +0x3c5 fp=0xc000425df8 sp=0xc000425d60 pc=0x4307e05
github.com/btmura/ponzi2/internal/app/controller.(*Controller).RunLoop(0xc00041a1c0, 0x0, 0x0)
	/Users/abhobe/ponzi2/internal/app/controller/controller.go:64 +0x85 fp=0xc000425ea0 sp=0xc000425df8 pc=0x432eb65
github.com/btmura/ponzi2/internal/app.(*App).Run(0xc000425f58, 0xc00000e078, 0x0)
	/Users/abhobe/ponzi2/internal/app/app.go:35 +0x89 fp=0xc000425ee8 sp=0xc000425ea0 pc=0x4337329
main.main()
	/Users/abhobe/ponzi2/cmd/ponzi2/ponzi2.go:28 +0x18b fp=0xc000425f88 sp=0xc000425ee8 pc=0x43375eb
runtime.main()
	/usr/local/Cellar/go/1.16/libexec/src/runtime/proc.go:225 +0x256 fp=0xc000425fe0 sp=0xc000425f88 pc=0x403cff6
runtime.goexit()
	/usr/local/Cellar/go/1.16/libexec/src/runtime/asm_amd64.s:1371 +0x1 fp=0xc000425fe8 sp=0xc000425fe0 pc=0x406fae1

Line 12 "github.com/go-gl/gl/v4.1-core/gl"

Line 198 & 199

glfw.WindowHint(glfw.ContextVersionMajor, 4)
// glfw.WindowHint(glfw.ContextVersionMinor, 1)

from ponzi2.

btmura avatar btmura commented on August 26, 2024

I see v4.5-core in the stack trace still.

Do you still have imports referencing 4.5? You have to change any v4.5-core imports to v4.1-core in all files?

For example, interna/app/gfx/gfx.go has an import including v4.5-core which would need to be changed to v4.1-core.

from ponzi2.

abhobe avatar abhobe commented on August 26, 2024

I found all imports, fixed them, and built it, but get this error at execution.

I 14:56:51 ui.go:225 OpenGL version: 4.1 INTEL-16.1.11
F 14:56:51 ponzi2.go:28 gl.go:65: failed to compile shader:

type: 35633

source: "#version 450 core\n\nlayout(location = 0) uniform mat4 projectionViewMatrix;\nlayout(location = 1) uniform mat4 modelMatrix;\n\nlayout(location = 2) in vec4 position;\nlayout(location = 3) in vec4 inColor;\nlayout(location = 4) in vec2 inTexCoord;\n\nout vec4 color;\nout vec2 texCoord;\n\nvoid main(void) {\n\tgl_Position = projectionViewMatrix * modelMatrix * position;\n\tcolor = inColor;\n\ttexCoord = inTexCoord;\n}"

log: "ERROR: 0:1: '' :  version '450' is not supported\nERROR: 0:1: '' : syntax error: #version\nERROR: 0:2: '' :  #version required and missing.\nERROR: 0:3: '0' : syntax error: integers in layouts require GLSL 140 or later\n\x00\x00"

from ponzi2.

btmura avatar btmura commented on August 26, 2024

It looks like the shader files need to be tweaked to be written in version 1.4. IIRC, they started naming the shader version and the GL version as the same after 4.5.

  1. Change "#version 450 core" at the top of shader.frag and shader.vert to "#version 140".

  2. In shader.vert, add the following two lines after the version:
    #extension GL_ARB_explicit_attrib_location : enable
    #extension GL_ARB_explicit_uniform_location : enable

  3. In shader.frag, add the following line after the version:
    #extension GL_ARB_explicit_uniform_location : enable

  4. I also changed the context version minor number and uncommented it:

glfw.WindowHint(glfw.ContextVersionMajor, 4)
glfw.WindowHint(glfw.ContextVersionMinor, 1)

from ponzi2.

btmura avatar btmura commented on August 26, 2024

Also, since we are modifying the shader files, make sure to run "go generate ./..." to rebuild the data files and then the go build command you were using to recompile the program.

from ponzi2.

abhobe avatar abhobe commented on August 26, 2024

Didn't work

I 13:28:23 ui.go:225 OpenGL version: 4.1 ATI-4.2.15
F 13:28:23 ponzi2.go:28 gl.go:65: failed to compile shader:

type: 35633

source: 
"#version 140 core\n\n#extension GL_ARB_explicit_attrib_location : enable\n
#extension GL_ARB_explicit_uniform_location : enable\n\nlayout(location = 0) uniform mat4 projectionViewMatrix;\n
layout(location = 1) uniform mat4 modelMatrix;\n\n
layout(location = 2) in vec4 position;\nlayout(location = 3) in vec4 inColor;\nlayout(location = 4) in vec2 inTexCoord;\n\n
out vec4 color;\n
out vec2 texCoord;\n\n
void main(void) {\n\tgl_Position = projectionViewMatrix * modelMatrix * position;\n\tcolor = inColor;\n\ttexCoord = inTexCoord;\n}\n"

log: 
"WARNING: 0:4: extension 'GL_ARB_explicit_uniform_location' is not supported\n
ERROR: 0:6: Invalid use of layout 'location'\nERROR: 0:7: Invalid use of layout 'location'\n
ERROR: 0:17: Use of undeclared identifier 'projectionViewMatrix'\n
ERROR: 0:17: Use of undeclared identifier 'modelMatrix'\n\x00\x00

from ponzi2.

btmura avatar btmura commented on August 26, 2024

At this point, I guess we would need to rewrite these two shader files without using "layout(location = 1)" syntax and slightly tweak the code in gfx.go to use the prior approach of getUniformAttribLocation or something similar.

from ponzi2.

abhobe avatar abhobe commented on August 26, 2024

I can try to do that, but I'm not familiar with the syntax and language. Can you point me to some resources that may be helpful?

from ponzi2.

btmura avatar btmura commented on August 26, 2024

Hi abhobe,

I had a previous Go program that used an older shader language that provides a good example of what to do.

If you are still interested in making this change, let me know as I might need to write up more detailed instructions.

Anyway, here are the links to those older shader files just in case I need to write more instructions.

https://github.com/btmura/blockcillin/blob/master/internal/renderer/renderer.go#L133
https://github.com/btmura/blockcillin/blob/master/internal/asset/data/shader.vert
https://github.com/btmura/blockcillin/blob/master/internal/renderer/gl.go#L102
https://github.com/btmura/blockcillin/blob/master/internal/renderer/gl.go#L110

from ponzi2.

abhobe avatar abhobe commented on August 26, 2024

Thanks! I'll look into it!

from ponzi2.

Related Issues (10)

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.