ewlc icon indicating copy to clipboard operation
ewlc copied to clipboard

glfw window not showing when not creating OpenGL context

Open WLCIssuesBot opened this issue 8 years ago • 8 comments
trafficstars

Issue by karroffel Tuesday Apr 18, 2017 at 23:45 GMT Originally opened as https://github.com/Cloudef/wlc/issues/260


When trying to create a glfw windows without using a client API (aka not creating an OpenGL context) then the window doesn't display.

#include <stdio.h>

#include <GLFW/glfw3.h>

int main()
{
        if (glfwInit() != GLFW_TRUE) {
                fprintf(stderr, "Couldn't initialize glfw\n");
                return 1;
        }

        glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE);

        // if you comment out this line then it works just fine.
        glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);

        GLFWwindow *window = glfwCreateWindow(1280, 720, "sway test", NULL, NULL);

        while (!glfwWindowShouldClose(window)) {
                glfwPollEvents();
        }

        glfwTerminate();

        return 0;
}

(compile with clang/gcc filename.c -lglfw)

Neither the wayland or the x11 build of glfw work.

Works on:

  • weston
  • plasma wayland
  • GNOME wayland

Doesn't work on:

  • sway
  • orbment

Both sway and orbment use wlc, so the problem might lie here somewhere.

WLCIssuesBot avatar May 03 '17 09:05 WLCIssuesBot

@karroffel doesn't work on weston for me though

Enerccio avatar May 03 '17 10:05 Enerccio

@Enerccio the glfw-x11 or glfw-wayland doesn't work on weston?

karroffel avatar May 03 '17 10:05 karroffel

I tried with glfw-wayland

Enerccio avatar May 03 '17 11:05 Enerccio

What exactly doesn't work though? Can't initialize? Does the window just not show? It shows but shows crap?

Because if you use glfw without an OpenGL context it doesn't have a proper framebuffer assigned, so it's expected to show random stuff from VRAM.

Does it work with the x11 version though? I don't really care which one works as long as I can develop applications using Vulkan 😄

karroffel avatar May 03 '17 11:05 karroffel

window does not show, cpu spins like crazy

Enerccio avatar May 03 '17 11:05 Enerccio

x11 version opens window (not in xwayland, outside in normal x windows), which is same behavior as in wlc

Enerccio avatar May 03 '17 11:05 Enerccio

Do you have the line commented out? Because if you have it commented out then it creates an OpenGL context.

If you don't have it commented out then I'm clueless and it's probably something with my machine or so

karroffel avatar May 03 '17 12:05 karroffel

I do not have it commented out. FWIW when I do comment it out, no window gets created (tested with wayland version) and it fails on assert

Enerccio avatar May 03 '17 12:05 Enerccio