patriciogonzalezvivo / glslViewer

Console-based GLSL Sandbox for 2D/3D shaders
BSD 3-Clause "New" or "Revised" License
4.66k stars 351 forks source link

Error compiling from sources on Ubuntu 18.04 (Windows Subsystem for Linux) #136

Open DonKichot opened 5 years ago

DonKichot commented 5 years ago
make
src/window.o
g++ -Wall -O3 -std=c++11 -fpermissive -DPLATFORM_LINUX -I/usr/local/include -I/usr/include/libdrm -Isrc/ -Iinclude/ -g -c src/window.cpp -o src/window.o -Wno-deprecated-declarations
src/window.cpp: In function ‘void initGL(glm::ivec4&, bool, bool)’:
src/window.cpp:202:42: error: ‘GL_FALSE’ was not declared in this scope
             glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
                                          ^~~~~~~~
src/window.cpp:202:42: note: suggested alternative: ‘GLFW_FALSE’
             glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
                                          ^~~~~~~~
                                          GLFW_FALSE
src/window.cpp:206:43: error: ‘GL_TRUE’ was not declared in this scope
             glfwWindowHint(GLFW_FLOATING, GL_TRUE);
                                           ^~~~~~~
src/window.cpp:206:43: note: suggested alternative: ‘GLFW_TRUE’
             glfwWindowHint(GLFW_FLOATING, GL_TRUE);
                                           ^~~~~~~
                                           GLFW_TRUE
src/window.cpp: In function ‘void closeGL()’:
src/window.cpp:482:42: error: ‘GL_TRUE’ was not declared in this scope
         glfwSetWindowShouldClose(window, GL_TRUE);
                                          ^~~~~~~
src/window.cpp:482:42: note: suggested alternative: ‘GLFW_TRUE’
         glfwSetWindowShouldClose(window, GL_TRUE);
                                          ^~~~~~~
                                          GLFW_TRUE
src/window.cpp: In function ‘void setWindowSize(int, int)’:
src/window.cpp:492:5: error: ‘glViewport’ was not declared in this scope
     glViewport(0.0, 0.0, (float)getWindowWidth(), (float)getWindowHeight());
     ^~~~~~~~~~
src/window.cpp:492:5: note: suggested alternative: ‘getViewport’
     glViewport(0.0, 0.0, (float)getWindowWidth(), (float)getWindowHeight());
     ^~~~~~~~~~
     getViewport
Makefile:60: recipe for target 'src/window.o' failed
make: *** [src/window.o] Error 1
gncgnc commented 5 years ago

WSL can't run graphical programs out of the box, you'll have to try it with an X server.

patriciogonzalezvivo commented 5 years ago

Have you install GLFW?

Maybe related to https://github.com/patriciogonzalezvivo/glslViewer/issues/140 ??

saltire commented 5 years ago

I got it to compile in WSL by installing libglew-dev and adding the following:

I also installed and ran vcXsrv on Windows, and set DISPLAY=:0.0 in WSL.

However, running glslViewer I get a segfault, and that's as far as I've gotten.

pipriles commented 2 years ago

Any idea why this might be happening? I am also trying to run glslViewer in WSL but I also get segfault.

patriciogonzalezvivo commented 2 years ago

Hi! the code had change dramatically since we close this thread in 2019. Do you mind describing what GlslViewer version are you running and providing how the command prompt looks like (what arguments and shader you pass, how the error looks, etc)

pipriles commented 2 years ago

I'll open an issue tomorrow morning

pipriles commented 2 years ago

Well, I found that the solution in my case was to simply start the X server with the option "Native opengl" uncheck (I am using VcXsrv Windows X Server)

image

patriciogonzalezvivo commented 2 years ago

Thank you!

raphaklaus commented 1 year ago

Just in case WSL2 users want to make it work, it also helped me: https://aalonso.dev/blog/how-to-use-gui-apps-in-wsl2-forwarding-x-server-cdj

patriciogonzalezvivo commented 1 year ago

Thank you @raphaklaus, I will add it to the documentation