Skip to content

Problem: Linux glfw drawing #11

@kanryu

Description

@kanryu

Please show me your wisdom.

When using mado with glfw layer, there is a problem on both x11 and wayland on Linux. The two problems are different.

x11

  • Window frames and title bars are visible.
  • Can operate window
  • OpenGL drawing is not done.
  • OpenGL API does not output error code

want to solve

  • OpenGL rendering become visible

wayland

  • Window borders and title bars are not displayed
  • Unable to operate window
  • OpenGL drawing is performed

want to solve

  • Display window frame

wayland in mado mode

  • Window frame is displayed
  • At this time, looking at os_wayland.go and egl_wayland.go, it appears that the window frame is being drawn by itself.
  • I would like to know how to draw a Window frame in the Window Manager in a wayland environment because this behavior is inappropriate when providing OpenGL drawing with complete freedom to the user like glfw.

wayland behavior in ubuntu-22.04.3

wl_registry_add_listener() does'nt callback zxdg_decoration_manager_v1.

This object is necessary for mado (gioui) to request the Window Manager to draw the application's own window frame, but initialization fails because the object is not provided by the OS. In the end, the application's window frame is not drawn.

I tested at home what specific wayland objects are provided by Ubuntu, but I can't write them here because I can't enter the environment right now. I'll write it here when I get home.

This library may help

gl never renders

Since then, I have spent many days almost completely porting the setup code for the x11 environment using glfw's EGL, but I still haven't been able to confirm OpenGL rendering in x11. There is a large amount of x11 source code left behind by glfw, and it is difficult to determine which code is interfering with OpenGL initialization, so for x11/egl, it is better to port initialization code other than glfw. Maybe.

I discovered a perfect product called glmark2. It has a complete initialization routine that support both of OpenGL/ES with EGL, and overall seems much simpler than glfw. I like that it also supports Android rendering. I'm planning to try porting from glmark2 starting tomorrow.

https://github.com/glmark2/glmark2

glad

Finally, I found a good example. :)

https://github.com/kanryu/glad

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions