Enerccio / ewlc

Wayland compositor library - extended
MIT License
20 stars 3 forks source link

glfw window not showing when not creating OpenGL context #96

Open WLCIssuesBot opened 7 years ago

WLCIssuesBot commented 7 years ago

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:

Doesn't work on:

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

Enerccio commented 7 years ago

@karroffel doesn't work on weston for me though

karroffel commented 7 years ago

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

Enerccio commented 7 years ago

I tried with glfw-wayland

karroffel commented 7 years ago

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 😄

Enerccio commented 7 years ago

window does not show, cpu spins like crazy

Enerccio commented 7 years ago

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

karroffel commented 7 years ago

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

Enerccio commented 7 years ago

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