Willy Scheibel has proposed merging lp:~willyscheibel/widelands/use-glbinding into lp:widelands.
Requested reviews: Widelands Developers (widelands-dev) For more details, see: https://code.launchpad.net/~willyscheibel/widelands/use-glbinding/+merge/243642 Add possibility to compile and run widelands using glbinding (https://github.com/hpicgs/glbinding) instead of GLEW. -- Your team Widelands Developers is requested to review the proposed merge of lp:~willyscheibel/widelands/use-glbinding into lp:widelands.
=== modified file 'CMakeLists.txt' --- CMakeLists.txt 2014-12-03 19:14:07 +0000 +++ CMakeLists.txt 2014-12-04 11:42:22 +0000 @@ -39,7 +39,6 @@ find_package (PythonInterp REQUIRED) -find_package(GLEW REQUIRED) find_package(Gettext REQUIRED) find_package(OpenGL REQUIRED) find_package(PNG REQUIRED) === modified file 'cmake/WlFunctions.cmake' --- cmake/WlFunctions.cmake 2014-12-03 19:14:07 +0000 +++ cmake/WlFunctions.cmake 2014-12-04 11:42:22 +0000 @@ -85,11 +85,21 @@ # OpenGL and GLEW are one thing for us. If you use the one, you also use the # other. + option(OPTION_USE_GLBINDING "USe glbinding instead of GLEW" OFF) if(ARG_USES_OPENGL) - wl_include_system_directories(${NAME} ${GLEW_INCLUDE_DIR}) - target_link_libraries(${NAME} ${GLEW_LIBRARY}) - target_link_libraries(${NAME} ${OPENGL_gl_LIBRARY}) - add_definitions(${GLEW_EXTRA_DEFINITIONS}) + if(OPTION_USE_GLBINDING) + find_package(glbinding REQUIRED) + wl_include_system_directories(${NAME} ${GLBINDING_INCLUDES}) + target_link_libraries(${NAME} ${GLBINDING_LIBRARIES}) + target_link_libraries(${NAME} ${OPENGL_gl_LIBRARY}) + add_definitions("-DUSE_GLBINDING") + else() + find_package(GLEW REQUIRED) + wl_include_system_directories(${NAME} ${GLEW_INCLUDE_DIR}) + target_link_libraries(${NAME} ${GLEW_LIBRARY}) + target_link_libraries(${NAME} ${OPENGL_gl_LIBRARY}) + add_definitions(${GLEW_EXTRA_DEFINITIONS}) + endif() endif() if(ARG_USES_PNG) === modified file 'src/graphic/gl/dither_program.cc' --- src/graphic/gl/dither_program.cc 2014-11-28 05:40:53 +0000 +++ src/graphic/gl/dither_program.cc 2014-12-04 11:42:22 +0000 @@ -91,10 +91,10 @@ dither_mask_.reset(new Texture(load_image_as_sdl_surface("world/pics/edge.png", g_fs), true)); glBindTexture(GL_TEXTURE_2D, dither_mask_->get_gl_texture()); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, static_cast<GLint>(GL_CLAMP)); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, static_cast<GLint>(GL_CLAMP)); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, static_cast<GLint>(GL_LINEAR)); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, static_cast<GLint>(GL_LINEAR)); glBindTexture(GL_TEXTURE_2D, 0); } === modified file 'src/graphic/gl/system_headers.h' --- src/graphic/gl/system_headers.h 2014-11-09 17:51:54 +0000 +++ src/graphic/gl/system_headers.h 2014-12-04 11:42:22 +0000 @@ -34,6 +34,14 @@ // GLEW must be first. Do not include any other GL headers, it // should define all functions. -#include <GL/glew.h> + +#ifdef USE_GLBINDING +# include <glbinding/gl/gl.h> +# include <glbinding/Binding.h> +using namespace glbinding; +using namespace gl; +#else +# include <GL/glew.h> +#endif #endif // end of include guard: WL_GRAPHIC_GL_SYSTEM_HEADERS_H === modified file 'src/graphic/graphic.cc' --- src/graphic/graphic.cc 2014-12-01 21:28:21 +0000 +++ src/graphic/graphic.cc 2014-12-04 11:42:22 +0000 @@ -96,6 +96,9 @@ // See graphic/gl/system_headers.h for an explanation of the // next line. +#ifdef USE_GLBINDING + Binding::initialize(); +#else glewExperimental = GL_TRUE; GLenum err = glewInit(); if (err != GLEW_OK) { @@ -103,6 +106,7 @@ err, glewGetErrorString(err)); throw wexception("glewInit returns %i: Broken OpenGL installation.", err); } +#endif log("Graphics: OpenGL: Version \"%s\"\n", reinterpret_cast<const char*>(glGetString(GL_VERSION))); === modified file 'src/graphic/screen.cc' --- src/graphic/screen.cc 2014-11-24 06:31:16 +0000 +++ src/graphic/screen.cc 2014-12-04 11:42:22 +0000 @@ -62,9 +62,9 @@ // TODO(unknown): terrain dither picture somehow leave the alpha // channel with non-1 values, so it is cleared before // accessing pixels. - glColorMask(false, false, false, true); + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glColorMask(true, true, true, true); + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glReadPixels(0, 0, m_w, m_h, GL_RGBA, GL_UNSIGNED_BYTE, m_pixels.get()); swap_rows(); } === modified file 'src/graphic/texture.cc' --- src/graphic/texture.cc 2014-12-02 08:31:02 +0000 +++ src/graphic/texture.cc 2014-12-04 11:42:22 +0000 @@ -80,8 +80,8 @@ return; } glTexImage2D - (GL_TEXTURE_2D, 0, GL_RGBA, m_w, m_h, 0, GL_RGBA, - GL_UNSIGNED_BYTE, nullptr); + (GL_TEXTURE_2D, 0, static_cast<GLint>(GL_RGBA), m_w, m_h, 0, GL_RGBA, + GL_UNSIGNED_BYTE, nullptr); } Texture::Texture(SDL_Surface * surface, bool intensity) @@ -115,7 +115,7 @@ SDL_LockSurface(surface); glTexImage2D - (GL_TEXTURE_2D, 0, intensity ? GL_INTENSITY : GL_RGBA, m_w, m_h, 0, + (GL_TEXTURE_2D, 0, static_cast<GLint>(intensity ? GL_INTENSITY : GL_RGBA), m_w, m_h, 0, pixels_format, GL_UNSIGNED_BYTE, surface->pixels); SDL_UnlockSurface(surface); @@ -171,8 +171,8 @@ // set texture filter to use linear filtering. This looks nicer for resized // texture. Most textures and images are not resized so the filtering // makes no difference - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, static_cast<GLint>(GL_LINEAR)); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, static_cast<GLint>(GL_LINEAR)); } void Texture::lock(LockMode mode) { @@ -205,7 +205,7 @@ if (mode == Unlock_Update) { glBindTexture(GL_TEXTURE_2D, m_texture); glTexImage2D - (GL_TEXTURE_2D, 0, GL_RGBA, m_w, m_h, 0, GL_RGBA, + (GL_TEXTURE_2D, 0, static_cast<GLint>(GL_RGBA), m_w, m_h, 0, GL_RGBA, GL_UNSIGNED_BYTE, m_pixels.get()); glBindTexture(GL_TEXTURE_2D, 0); } === modified file 'src/ui_fsmenu/editor.h' --- src/ui_fsmenu/editor.h 2014-12-04 06:35:12 +0000 +++ src/ui_fsmenu/editor.h 2014-12-04 11:42:22 +0000 @@ -33,7 +33,7 @@ public: FullscreenMenuEditor(); - enum class MenuTarget { kBack = UI::Panel::dying_code, kNewMap, kLoadMap }; + enum class MenuTarget {kBack = UI::Panel::dying_code, kNewMap, kLoadMap}; private: UI::Textarea title;
_______________________________________________ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp