g3n / engine

Go 3D Game Engine (http://g3n.rocks)
https://discord.gg/NfaeVr8zDg
BSD 2-Clause "Simplified" License
2.8k stars 295 forks source link

The program does not render examples #7

Closed SavostinVladimir closed 7 years ago

SavostinVladimir commented 7 years ago

I use windows 64. Downloaded the engine from the gitnab and try to run the examples, such as "HelloG3n" or "gopher3d". But only new window appears and shows nothing. Nothing exept the background color. After I close the window programm ends with exit-code:0.

I do not understand what's the matter! Please,I need your help!

additionaly, the first time it got error, that it don't may use type int as argument of glfw.CreateStandartCursor in "glfw.go". This fragment introduced below: // Preallocate standard cursors w.arrowCursor = glfw.CreateStandardCursor(int(glfw.ArrowCursor)) w.ibeamCursor = glfw.CreateStandardCursor(int(glfw.IBeamCursor)) w.crosshairCursor = glfw.CreateStandardCursor(int(glfw.CrosshairCursor)) w.handCursor = glfw.CreateStandardCursor(int(glfw.HandCursor)) w.hresizeCursor = glfw.CreateStandardCursor(int(glfw.HResizeCursor)) w.vresizeCursor = glfw.CreateStandardCursor(int(glfw.VResizeCursor)) After this I remove all int from showed strings. But I don't think that it's reason...

leonsal commented 7 years ago

Could you please post the complete Go stack trace when the error occurs ?

SavostinVladimir commented 7 years ago

this is my stack if glfw.CreateStandardCursor get type int:

GOROOT=C:/go
GOPATH=C:/GoProjects
C:/go\bin\go.exe build -i -o "C:\Users\ASUS\AppData\Local\Temp\Build main.go and rungo" C:/GoProjects/src/github.com/g3n/demos/gopher3d/main.go
# github.com/g3n/engine/window
..\..\engine\window\glfw.go:159: cannot use int(glfw.ArrowCursor) (type int) as type glfw.StandardCursor in argument to glfw.CreateStandardCursor
..\..\engine\window\glfw.go:160: cannot use int(glfw.IBeamCursor) (type int) as type glfw.StandardCursor in argument to glfw.CreateStandardCursor
..\..\engine\window\glfw.go:161: cannot use int(glfw.CrosshairCursor) (type int) as type glfw.StandardCursor in argument to glfw.CreateStandardCursor
..\..\engine\window\glfw.go:162: cannot use int(glfw.HandCursor) (type int) as type glfw.StandardCursor in argument to glfw.CreateStandardCursor
..\..\engine\window\glfw.go:163: cannot use int(glfw.HResizeCursor) (type int) as type glfw.StandardCursor in argument to glfw.CreateStandardCursor
..\..\engine\window\glfw.go:164: cannot use int(glfw.VResizeCursor) (type int) as type glfw.StandardCursor in argument to glfw.CreateStandardCursor
SavostinVladimir commented 7 years ago

But if I change the glfw.go myself in the following way(remove int):

        w.arrowCursor = glfw.CreateStandardCursor(glfw.ArrowCursor)
    w.ibeamCursor = glfw.CreateStandardCursor(glfw.IBeamCursor)
    w.crosshairCursor = glfw.CreateStandardCursor(glfw.CrosshairCursor)
    w.handCursor = glfw.CreateStandardCursor(glfw.HandCursor)
    w.hresizeCursor = glfw.CreateStandardCursor(glfw.HResizeCursor)
    w.vresizeCursor = glfw.CreateStandardCursor(glfw.VResizeCursor)

I get this stack in run-mode:

GOROOT=C:/go
GOPATH=C:/GoProjects
C:/go\bin\go.exe build -i -o "C:\Users\ASUS\AppData\Local\Temp\Build main.go and rungo" C:/GoProjects/src/github.com/g3n/demos/gopher3d/main.go
"C:\Program Files (x86)\JetBrains\Gogland 171.3780.106\bin\runnerw.exe" "C:\Users\ASUS\AppData\Local\Temp\Build main.go and rungo"

and after I close window "Gopher3D" it ends with exit code 0 Process finished with exit code 0

and in debug-mode I have:

GOROOT=C:/go
GOPATH=C:/GoProjects
C:/go\bin\go.exe build -i -o "C:\Users\ASUS\AppData\Local\Temp\Build main.go and rungo" -gcflags "-N -l" "-ldflags=-linkmode internal" C:/GoProjects/src/github.com/g3n/demos/gopher3d/main.go
# command-line-arguments
github.com/go-gl/glfw/v3.2/glfw(.text): relocation target strdup not defined
github.com/go-gl/glfw/v3.2/glfw(.text): relocation target strdup not defined
github.com/go-gl/glfw/v3.2/glfw(.text): relocation target strdup not defined
github.com/go-gl/glfw/v3.2/glfw(.text): relocation target strdup not defined
github.com/go-gl/glfw/v3.2/glfw(.text): undefined: "strdup"
github.com/go-gl/glfw/v3.2/glfw(.text): undefined: "strdup"
github.com/go-gl/glfw/v3.2/glfw(.text): undefined: "strdup"
github.com/go-gl/glfw/v3.2/glfw(.text): undefined: "strdup"
leonsal commented 7 years ago

Hi, there was a recent modification of the glfw API which removed the necessity to cast the standard cursor type to int. The g3n engine repository was updated right now to fix this. After this change we were able to build the demos and run them OK.

Update your packages and try again, it seems you are getting a linker error.

>go get -u github.com/go-gl/glfw/v3.2/glfw
>go get -u github.com/g3n/engine/...
SavostinVladimir commented 7 years ago

Hello! I looked your commit. I did same thing, but its not enough. So I folowed your advice and updated my packages... You may see my screen during implementation: mysceenrun It still does not render((

And this is same example, during debug: mysceendebug

SavostinVladimir commented 7 years ago

may be it helps... This is my stack, when I run your "G3N demo" demo-programm:

"C:\Program Files (x86)\JetBrains\Gogland 171.3780.106\bin\runnerw.exe" C:/go\bin\go.exe run C:/GoProjects/src/github.com/g3n/g3nd/main.go
09:34:08.691806:I:G3ND:G3N Demo v0.1 starting
09:34:08.691806:I:G3ND:Using data directory:data
09:34:09.317842:I:G3ND:OpenGL version: 3.3.11159 Core Profile Context
09:34:09.318842:W:G3ND:Error trying to load OpenAL library
09:34:10.145889:F:G3ND:Render error: Error compiling Vertex Shader: Vertex shader was successfully compiled to run on hardware.
  01:
02:#version 330 core
03:
04:// Vertex attributes
05:
06:// Vertex attributes
07:layout(location = 0) in vec3  VertexPosition;
08:layout(location = 1) in vec3  VertexNormal;
09:layout(location = 2) in vec3  VertexColor;
10:layout(location = 3) in vec2  VertexTexcoord;
11:layout(location = 4) in float VertexDistance;
12:layout(location = 5) in vec4  VertexTexoffsets;
13:
14:
15:// Input uniforms
16:uniform mat4 ModelMatrix;
17:
18:// Outputs for fragment shader
19:out vec2 FragTexcoord;
20:
21:
22:void main() {
23:
24:    // Always flip texture coordinates
25:    vec2 texcoord = VertexTexcoord;
26:    texcoord.y = 1 - texcoord.y;
27:    FragTexcoord = texcoord;
28:
29:    // Set position
30:    vec4 pos = vec4(VertexPosition.xyz, 1);
31:    gl_Position = ModelMatrix * pos;
32:}
33:

panic: LOG FATAL

goroutine 1 [running, locked to thread]:
github.com/g3n/engine/util/logger.(*Logger).Log(0xc04214eee0, 0x4, 0x73c6b6, 0x11, 0xc042029d98, 0x1, 0x1)
    C:/GoProjects/src/github.com/g3n/engine/util/logger/logger.go:253 +0x89b
github.com/g3n/engine/util/logger.(*Logger).Fatal(0xc04214eee0, 0x73c6b6, 0x11, 0xc042029d98, 0x1, 0x1)
    C:/GoProjects/src/github.com/g3n/engine/util/logger/logger.go:194 +0x6d
main.main()
    C:/GoProjects/src/github.com/g3n/g3nd/main.go:256 +0xc38
exit status 2

Process finished with exit code 1
leonsal commented 7 years ago

It is very strange. The log shows that an error occurred while compiling the vertex shader, but the error message says it was compiled OK.

  1. Which Windows version do you use ?
  2. Do you a have a GPU installed in your system ?
  3. Is your video card OpenGL driver updated ?
  4. Have you run successfully another OpenGL 3D application ?
SavostinVladimir commented 7 years ago

Hi, I just tried to update my drivers, you can look at it: videodriverinfo System says that the relevant driver is already installed. I use the windows 7, Service Pack 1, 64 bit What about other 3D applications, I find it dificult to check this. This area of knowledge is new for me, sorry. But I run some 3D games on my computer, I think some of them use the OpenGL... Thank you for your attention. May be this information will help to understand what's wrong

leonsal commented 7 years ago

It seems your drivers are OK. Try to eliminate a check we do when we compile the shaders: In file: github.com/g3n/engine/gls/program.go, comment lines 503,504 and 505

503 //if len(slog) > 2 {
504 //  return shader, fmt.Errorf("%s", slog)
505 //}

Then build g3nd and try again.

SavostinVladimir commented 7 years ago

Great! It works! I remain it, but will this not cause errors in future projects? But now there is other problems in your demo program "g3nd"... g3ndwheremenu

I will try to read other issues and solve it myself. If I will failure, it will be the topic of a new issue. Thank you very much! I appreciate your help!

leonsal commented 7 years ago

OK, a new commit was sent which logs the shader compiler log instead of returning an error. Please open a new issue for other problems.