Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMPORTANT] GLFW error and wrong (0,0) position #354

Closed
ax4w opened this issue Feb 27, 2024 · 11 comments
Closed

[IMPORTANT] GLFW error and wrong (0,0) position #354

ax4w opened this issue Feb 27, 2024 · 11 comments

Comments

@ax4w
Copy link

ax4w commented Feb 27, 2024

When added the newest raylib-go version to the project (v0.0.0-20240227065410-00f5f785e6ec) GLFW throws following errors:

WARNING: GLFW: Error: 65548 Description: Wayland: The platform does not provide the window position
WARNING: GLFW: Error: 65548 Description: Wayland: The platform does not provide the window position
WARNING: GLFW: Error: 65548 Description: Wayland: The platform does not support setting the window position

and every coordinate is off.
For example:

  • (0,0) is not in the top left
  • (400,0) for a 400x400 window is in the middle of the window

In the example the text should be rendered in (190,200), but when running this with the newest version of the module the text is in a different position

image

I've tried a program, which uses an older version of the module (v0.0.0-20240125111008-83d871a38f28) where no warnings appear and the (0,0) point is set correctly in the top left corner.

@gen2brain
Copy link
Owner

Well, the error is normal as Wayland doesn't support setting the window position. With the latest GLFW update binary now supports both X11 and Wayland and it will detect what to use in runtime (based on XDG_SESSION_TYPE).

What is not normal is that the coordinates are off, what compositor you are using? I tested a few examples and all works for me with labwc. Can you try in the X11 session just to confirm? Anyway, there is nothing that will happen here or that I can do to fix that. I can probably just return the wayland build tag, or maybe x11 tag to be something like compatibility mode, i.e. to force X11 on Wayland like before.

@ax4w
Copy link
Author

ax4w commented Feb 27, 2024

I use gnome. I just tried x11 and it seems to work (I changed the coordinates to (0,0) just to be sure):

image

As it worked in the older version, I think that forcing X11 would be the best solution.

@gen2brain
Copy link
Owner

The x11 build tag is added in c3665eb.

If you can, please also test with go build -tags sdl, as SDL will also detect and use Wayland I think. You can also force SDL_VIDEODRIVER to x11 or wayland there. I wonder if your issue is related to GNOME fractional scaling in some way and perhaps GLFW doesn't handle it properly.

@ax4w
Copy link
Author

ax4w commented Feb 27, 2024

I pulled the newest version with go get -v -u github.com/gen2brain/raylib-go/raylib
and the issue is still there (weirdly). With the sdl build tag, everything is as expected:
img

Without sdl it looks like this again:
img

go.mod is

module demo

go 1.22.0

require (
	github.com/ebitengine/purego v0.6.1 // indirect
	github.com/gen2brain/raylib-go/raylib v0.0.0-20240227114648-c3665eb9abf8 // indirect
	golang.org/x/sys v0.17.0 // indirect
)

did you change anything else since that version v0.0.0-20240125111008-83d871a38f28 ?

@gen2brain
Copy link
Owner

Check the output, when you see GLFW Wayland errors it is using Wayland. When you build with x11 tag, you should not see that anymore.

@gen2brain
Copy link
Owner

gen2brain commented Feb 27, 2024

Also, if you already checked SDL, try to force wayland then force x11, to make sure it is not using the compatibility layer there. I mean, force with SDL_VIDEODRIVER=wayland.

@ax4w
Copy link
Author

ax4w commented Feb 27, 2024

with x11 build tag, its working. Both sdl2 wayland and x11 seem to work aswell

@gen2brain
Copy link
Owner

Yes, you must use the x11 tag if you want the old behavior, the old one was to use X11.

@ax4w
Copy link
Author

ax4w commented Feb 27, 2024

Alright, then it seems to be a problem with glfw and wayland i assume?

@gen2brain
Copy link
Owner

Yes, to be precise, with GLFW, Wayland, and GNOME/mutter, I guess it would work in KDE/Kwin, and I did a test in labwc where works.

@ax4w
Copy link
Author

ax4w commented Feb 27, 2024

I see, good to know. Then the issue is resolved :D you can close it now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants