diff options
| -rw-r--r-- | CMake/options.cmake | 49 | ||||
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.H | 1 | ||||
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx | 7 |
3 files changed, 43 insertions, 14 deletions
diff --git a/CMake/options.cmake b/CMake/options.cmake index ea265515b..f9855a298 100644 --- a/CMake/options.cmake +++ b/CMake/options.cmake @@ -642,25 +642,42 @@ if(FLTK_BUILD_GL) if(FLTK_USE_WAYLAND) pkg_check_modules(WLD_EGL IMPORTED_TARGET wayland-egl) pkg_check_modules(PKG_EGL IMPORTED_TARGET egl) - pkg_check_modules(PKG_GL IMPORTED_TARGET gl) + if(FLTK_BACKEND_X11) + pkg_check_modules(PKG_GL IMPORTED_TARGET gl) + else() + pkg_check_modules(PKG_GL IMPORTED_TARGET opengl) + endif() pkg_check_modules(PKG_GLU IMPORTED_TARGET glu) if(NOT (WLD_EGL_FOUND AND PKG_EGL_FOUND AND PKG_GL_FOUND AND PKG_GLU_FOUND)) - message(STATUS "Modules 'wayland-egl, egl, gl, and glu' are required to build for the Wayland backend.") + message(STATUS "Modules 'wayland-egl, egl, gl (or opengl), and glu' are required to build for the Wayland backend.") message(FATAL_ERROR "*** Aborting ***") endif() endif(FLTK_USE_WAYLAND) - if(FLTK_BACKEND_X11) + if(FLTK_BACKEND_X11 OR FLTK_USE_WAYLAND) set(OPENGL_FOUND TRUE) - find_library(OPENGL_LIB GL) + if(FLTK_BACKEND_X11) + find_library(OPENGL_LIB GL) + else() + find_library(OPENGL_LIB OpenGL) + endif(FLTK_BACKEND_X11) get_filename_component(PATH_TO_GLLIB ${OPENGL_LIB} DIRECTORY) find_library(GLU_LIB GLU) get_filename_component(PATH_TO_GLULIB ${GLU_LIB} DIRECTORY) - # FIXME: we should find a better way to resolve this issue: - # with GL, must use XQuartz libX11 else "Insufficient GL support" - set(OPENGL_LIBRARIES -L${PATH_TO_GLULIB} -L${PATH_TO_GLLIB} -lX11 -lGLU -lGL) + set(OPENGL_LIBRARIES -L${PATH_TO_GLULIB} -L${PATH_TO_GLLIB}) + if(APPLE) + # FIXME: we should find a better way to resolve this issue: + # with GL, must use XQuartz libX11 else "Insufficient GL support" + set(OPENGL_LIBRARIES ${OPENGL_LIBRARIES} -lX11) + endif(APPLE) + set(OPENGL_LIBRARIES ${OPENGL_LIBRARIES} -lGLU) + if(FLTK_BACKEND_X11) + set(OPENGL_LIBRARIES ${OPENGL_LIBRARIES} -lGL) + else() + set(OPENGL_LIBRARIES ${OPENGL_LIBRARIES} -lOpenGL) + endif(FLTK_BACKEND_X11) find_path(OPENGL_INCLUDE_DIR NAMES GL/gl.h OpenGL/gl.h HINTS ${X11_INCLUDE_DIR}) unset(HAVE_GL_GLU_H CACHE) find_file(HAVE_GL_GLU_H GL/glu.h PATHS ${X11_INCLUDE_DIR}) @@ -669,7 +686,7 @@ if(FLTK_BUILD_GL) if(APPLE) set(HAVE_GL_GLU_H ${HAVE_OPENGL_GLU_H}) endif(APPLE) - endif(FLTK_BACKEND_X11) + endif(FLTK_BACKEND_X11 OR FLTK_USE_WAYLAND) else(FLTK_BUILD_GL) set(OPENGL_FOUND FALSE) set(HAVE_GL FALSE) @@ -711,12 +728,16 @@ if(OPENGL_FOUND) list(APPEND GLLIBS -lGLU -lGL) endif(WIN32) - # check if function glXGetProcAddressARB exists - set(TEMP_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) - set(CMAKE_REQUIRED_LIBRARIES ${OPENGL_LIBRARIES}) - check_symbol_exists(glXGetProcAddressARB "glx.h" HAVE_GLXGETPROCADDRESSARB) - set(CMAKE_REQUIRED_LIBRARIES ${TEMP_REQUIRED_LIBRARIES}) - unset(TEMP_REQUIRED_LIBRARIES) + if (FLTK_BACKEND_X11) + # check if function glXGetProcAddressARB exists + set(TEMP_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) + set(CMAKE_REQUIRED_LIBRARIES ${OPENGL_LIBRARIES}) + check_symbol_exists(glXGetProcAddressARB "glx.h" HAVE_GLXGETPROCADDRESSARB) + set(CMAKE_REQUIRED_LIBRARIES ${TEMP_REQUIRED_LIBRARIES}) + unset(TEMP_REQUIRED_LIBRARIES) + else() + unset(HAVE_GLXGETPROCADDRESSARB CACHE) + endif(FLTK_BACKEND_X11) endif(OPENGL_FOUND) ####################################################################### diff --git a/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.H b/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.H index a7622fc1c..ad67c01bf 100644 --- a/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.H +++ b/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.H @@ -51,6 +51,7 @@ private: void gl_start() FL_OVERRIDE; void gl_visual(Fl_Gl_Choice *c) FL_OVERRIDE; void init(); + void* GetProcAddress(const char *procName) FL_OVERRIDE; public: static void surface_frame_done(void *data, struct wl_callback *cb, uint32_t time); //virtual bool need_scissor() { return true; } // CONTROL_LEAKING_SUB_GL_WINDOWS diff --git a/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx index 18be68168..815196af9 100644 --- a/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx @@ -22,6 +22,7 @@ #include "Fl_Wayland_Window_Driver.H" #include "Fl_Wayland_Graphics_Driver.H" #include "Fl_Wayland_Gl_Window_Driver.H" +#include "../Posix/Fl_Posix_System_Driver.H" #ifdef FLTK_USE_X11 # include "../X11/Fl_X11_Gl_Window_Driver.H" #endif @@ -470,6 +471,12 @@ int Fl_Wayland_Gl_Window_Driver::swap_interval() const { return swap_interval_; } + +void* Fl_Wayland_Gl_Window_Driver::GetProcAddress(const char *procName) { + return Fl_Posix_System_Driver::dlopen_or_dlsym(NULL, procName); +} + + FL_EXPORT EGLContext fl_wl_glcontext(GLContext rc) { return (EGLContext)rc; } #endif // HAVE_GL |
