ALT Linux Bugzilla
– Attachment 13414 Details for
Bug 45876
Падает с ошибкой ...GLViewer.cpp:133) SetUpContext(): Error initialising GLEW
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
Патч замены GLEW на Epoxy
glew_to_epoxy.patch (text/plain), 10.51 KB, created by
Alexei V. Mezin
on 2023-06-07 00:34:38 MSK
(
hide
)
Description:
Патч замены GLEW на Epoxy
Filename:
MIME Type:
Creator:
Alexei V. Mezin
Created:
2023-06-07 00:34:38 MSK
Size:
10.51 KB
patch
obsolete
>--- a/src/hugin1/hugin/ProjectionGridTool.cpp >+++ b/src/hugin1/hugin/ProjectionGridTool.cpp >@@ -24,12 +24,10 @@ > #ifdef _WIN32 > #include "wx/msw/wrapwin.h" > #endif >-#include <GL/glew.h> >+#include <epoxy/gl.h> > #ifdef __WXMAC__ >-#include <OpenGL/gl.h> > #include <OpenGL/glu.h> > #else >-#include <GL/gl.h> > #include <GL/glu.h> > #endif > #ifdef __APPLE__ >@@ -323,7 +321,7 @@ > if (!checked_anisotropic) > { > // check if it is supported >- if (GLEW_EXT_texture_filter_anisotropic) >+ if (epoxy_has_gl_extension("GL_EXT_texture_filter_anisotropic")) > { > has_anisotropic = true; > glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &anisotropy); >--- a/src/hugin1/hugin/TextureManager.cpp >+++ b/src/hugin1/hugin/TextureManager.cpp >@@ -48,15 +48,13 @@ > > // The OpenGL Extension wrangler libray will find extensions and the latest > // supported OpenGL version on all platforms. >-#include <GL/glew.h> >+#include <epoxy/gl.h> > #include <wx/platform.h> > #include <wx/display.h> > > #ifdef __WXMAC__ >-#include <OpenGL/gl.h> > #include <OpenGL/glu.h> > #else >-#include <GL/gl.h> > #include <GL/glu.h> > #endif > >@@ -628,7 +626,7 @@ > if (!checked_anisotropic) > { > // check if it is supported >- if (GLEW_EXT_texture_filter_anisotropic) >+ if (epoxy_has_gl_extension("GL_EXT_texture_filter_anisotropic")) > { > has_anisotropic = true; > glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &anisotropy); >--- a/src/hugin_base/hugin_utils/utils.cpp >+++ b/src/hugin_base/hugin_utils/utils.cpp >@@ -57,9 +57,9 @@ > #include <libgen.h> /* dirname */ > #endif > >-#include <GL/glew.h> >+#include <epoxy/gl.h> > #ifdef _WIN32 >-#include <GL/wglew.h> >+#include <epoxy/wgl.h> > #elif defined __APPLE__ > #include <GLUT/glut.h> > #endif >@@ -584,6 +584,7 @@ > { > return false; > }; >+ epoxy_handle_external_wglMakeCurrent(); > return true; > } > >@@ -592,6 +593,7 @@ > if (context.renderingContext != NULL) > { > wglMakeCurrent(NULL, NULL); >+ epoxy_handle_external_wglMakeCurrent(); > wglDeleteContext(context.renderingContext); > } > if (context.window != NULL && context.dc != NULL) >@@ -628,7 +630,7 @@ > > #else > #if defined HAVE_EGL && HAVE_EGL >-#include <EGL/egl.h> >+#include <epoxy/egl.h> > > struct ContextSettings > { >@@ -714,7 +716,7 @@ > #else > #include <X11/Xlib.h> > #include <X11/Xutil.h> >-#include <GL/glx.h> >+#include <epoxy/glx.h> > > struct ContextSettings > { >@@ -811,26 +813,17 @@ > { > return false; > }; >- int err = glewInit(); >- if (err != GLEW_OK) >- { >- std::cerr << argv[0] << ": an error occurred while setting up the GPU:" << std::endl; >- std::cerr << glewGetErrorString(err) << std::endl; >- std::cerr << argv[0] << ": Switching to CPU calculation." << std::endl; >- DestroyContext(); >- return false; >- } > > std::cout << hugin_utils::stripPath(argv[0]) << ": using graphics card: " << glGetString(GL_VENDOR) << " " << glGetString(GL_RENDERER) << std::endl; > >- const GLboolean has_arb_fragment_shader = glewGetExtension("GL_ARB_fragment_shader"); >- const GLboolean has_arb_vertex_shader = glewGetExtension("GL_ARB_vertex_shader"); >- const GLboolean has_arb_shader_objects = glewGetExtension("GL_ARB_shader_objects"); >- const GLboolean has_arb_shading_language = glewGetExtension("GL_ARB_shading_language_100"); >- const GLboolean has_ext_framebuffer = glewGetExtension("GL_EXT_framebuffer_object"); >- const GLboolean has_arb_texture_rectangle = glewGetExtension("GL_ARB_texture_rectangle"); >- const GLboolean has_arb_texture_border_clamp = glewGetExtension("GL_ARB_texture_border_clamp"); >- const GLboolean has_arb_texture_float = glewGetExtension("GL_ARB_texture_float"); >+ const GLboolean has_arb_fragment_shader = epoxy_has_gl_extension("GL_ARB_fragment_shader"); >+ const GLboolean has_arb_vertex_shader = epoxy_has_gl_extension("GL_ARB_vertex_shader"); >+ const GLboolean has_arb_shader_objects = epoxy_has_gl_extension("GL_ARB_shader_objects"); >+ const GLboolean has_arb_shading_language = epoxy_has_gl_extension("GL_ARB_shading_language_100"); >+ const GLboolean has_ext_framebuffer = epoxy_has_gl_extension("GL_EXT_framebuffer_object"); >+ const GLboolean has_arb_texture_rectangle = epoxy_has_gl_extension("GL_ARB_texture_rectangle"); >+ const GLboolean has_arb_texture_border_clamp = epoxy_has_gl_extension("GL_ARB_texture_border_clamp"); >+ const GLboolean has_arb_texture_float = epoxy_has_gl_extension("GL_ARB_texture_float"); > > if (!(has_arb_fragment_shader && has_arb_vertex_shader && has_arb_shader_objects && has_arb_shading_language && has_ext_framebuffer && has_arb_texture_rectangle && has_arb_texture_border_clamp && has_arb_texture_float)) { > const char * msg[] = {"false", "true"}; >--- a/src/hugin_base/vigra_ext/ImageTransformsGPU.cpp >+++ b/src/hugin_base/vigra_ext/ImageTransformsGPU.cpp >@@ -26,7 +26,7 @@ > #include <iostream> > #include <iomanip> > >-#include <GL/glew.h> >+#include <epoxy/gl.h> > > #include <string.h> > #ifdef _WIN32 >@@ -54,6 +54,16 @@ > }; > #endif > #include <time.h> >+ >+#ifdef __WXMAC__ >+#include <OpenGL/glu.h> >+#else >+// after windows.h >+#include <GL/glu.h> >+#endif >+#ifdef __APPLE__ >+ #include <GLUT/glut.h> >+#endif > > #include <vector> > >@@ -798,7 +808,7 @@ > const int viewportHeight = std::max<int>(destChunks[0].height(), sourceChunks[0].height()); > glMatrixMode(GL_PROJECTION); > glLoadIdentity(); >- gluOrtho2D(0.0, viewportWidth, 0.0, viewportHeight); >+ glOrtho(0.0, viewportWidth, 0.0, viewportHeight, -1, 1); > glMatrixMode(GL_MODELVIEW); > glLoadIdentity(); > glViewport(0, 0, viewportWidth, viewportHeight); >--- a/CMakeLists.txt >+++ b/CMakeLists.txt >@@ -255,9 +255,9 @@ > INCLUDE_DIRECTORIES(${GLUT_INCLUDE_DIR}) > SET(OPENGL_GLEW_LIBRARIES ${OPENGL_GLEW_LIBRARIES} ${GLUT_LIBRARIES}) > ENDIF() >-FIND_PACKAGE(GLEW REQUIRED) >-INCLUDE_DIRECTORIES(${GLEW_INCLUDE_DIR}) >-SET(OPENGL_GLEW_LIBRARIES ${OPENGL_GLEW_LIBRARIES} ${GLEW_LIBRARIES}) >+PKG_SEARCH_MODULE(EPOXY epoxy REQUIRED) >+INCLUDE_DIRECTORIES(${EPOXY_INCLUDE_DIR}) >+SET(OPENGL_GLEW_LIBRARIES ${OPENGL_GLEW_LIBRARIES} ${EPOXY_LIBRARIES}) > IF(NOT HUGIN_SHARED OR NOT WIN32) > ADD_DEFINITIONS(-DGLEW_STATIC) > ENDIF() > >--- a/src/hugin1/hugin/GLPreviewFrame.cpp >+++ b/src/hugin1/hugin/GLPreviewFrame.cpp >@@ -28,8 +28,6 @@ > #include <iostream> > > #include "hugin_config.h" >- >-#include <GL/glew.h> > > #include "panoinc_WX.h" > #include "panoinc.h" >--- a/src/hugin1/hugin/GLViewer.cpp >+++ b/src/hugin1/hugin/GLViewer.cpp >@@ -25,7 +25,7 @@ > > #include "panoinc.h" > #include "hugin_config.h" >-#include <GL/glew.h> >+#include <epoxy/gl.h> > #include <base_wx/platform.h> > #include <wx/settings.h> > #include <wx/dcclient.h> >@@ -39,7 +39,6 @@ > #include "GLPreviewFrame.h" > #include "hugin/huginApp.h" > >-bool GLViewer::initialised_glew=false; > ViewState * GLViewer::m_view_state = NULL; > size_t GLViewer::m_view_state_observer = 0; > >@@ -121,24 +120,8 @@ > // It appears we are setting up for the first time. > started_creation = true; > >- if (!initialised_glew) >- { >- // initialise the glew library, if not done it before. >- GLenum error_state = glewInit(); >- initialised_glew = true; >- if (error_state != GLEW_OK) >- { >- // glewInit failed >- started_creation=false; >- DEBUG_ERROR("Error initialising GLEW: " >- << glewGetErrorString(error_state) << "."); >- frame->Close(); >- wxMessageBox(_("Error initializing GLEW\nFast preview window can not be opened."),_("Error"), wxOK | wxICON_ERROR); >- return; >- } >- } > // check the openGL capabilities. >- if (!(GLEW_VERSION_1_1 && GLEW_ARB_multitexture)) >+ if (epoxy_gl_version() < 11 && !epoxy_has_gl_extension("GL_ARB_multitexture")) > { > started_creation=false; > wxConfigBase::Get()->Write(wxT("DisableOpenGL"), 1l); >--- a/src/hugin1/hugin/GLViewer.h >+++ b/src/hugin1/hugin/GLViewer.h >@@ -99,7 +99,6 @@ > virtual void setUp() = 0; > > bool started_creation, redrawing, m_toolsInitialized; >- static bool initialised_glew; > vigra::Diff2D offset; > double m_scale = 1.0; > GLPreviewFrame *frame; >--- a/src/hugin1/hugin/MeshManager.cpp >+++ b/src/hugin1/hugin/MeshManager.cpp >@@ -23,15 +23,10 @@ > #include <wx/wx.h> > #include <wx/platform.h> > >-#include <GL/glew.h> >- >-#ifdef __WXMAC__ >-#include <OpenGL/gl.h> >-#else >+#include <epoxy/gl.h> >+ > #ifdef __WXMSW__ > #include <vigra/windows.h> >-#endif >-#include <GL/gl.h> > #endif > > #include "panoinc.h" >--- a/src/hugin1/hugin/OverviewOutlinesTool.cpp >+++ b/src/hugin1/hugin/OverviewOutlinesTool.cpp >@@ -22,12 +22,10 @@ > #ifdef _WIN32 > #include "wx/msw/wrapwin.h" > #endif >-#include <GL/glew.h> >+#include <epoxy/gl.h> > #ifdef __WXMAC__ >-#include <OpenGL/gl.h> > #include <OpenGL/glu.h> > #else >-#include <GL/gl.h> > #include <GL/glu.h> > #endif > #ifdef __APPLE__ >--- a/src/hugin1/hugin/PanosphereSphereTool.cpp >+++ b/src/hugin1/hugin/PanosphereSphereTool.cpp >@@ -24,12 +24,10 @@ > #ifdef _WIN32 > #include "wx/msw/wrapwin.h" > #endif >-#include <GL/glew.h> >+#include <epoxy/gl.h> > #ifdef __WXMAC__ >-#include <OpenGL/gl.h> > #include <OpenGL/glu.h> > #else >-#include <GL/gl.h> > #include <GL/glu.h> > #endif > #ifdef __APPLE__ >--- a/src/hugin1/hugin/PreviewDifferenceTool.cpp >+++ b/src/hugin1/hugin/PreviewDifferenceTool.cpp >@@ -24,13 +24,8 @@ > #endif > #include "PreviewDifferenceTool.h" > #include "hugin_config.h" >-#include <GL/glew.h> >+#include <epoxy/gl.h> > #include <wx/platform.h> >-#ifdef __WXMAC__ >-#include <OpenGL/gl.h> >-#else >-#include <GL/gl.h> >-#endif > > // This is the number of times to double the result of the difference. It should > // be between 0 and 7. Note that with values > 0 no extra colours are used >@@ -46,9 +41,9 @@ > /** call this function only after OpenGL context was created */ > bool PreviewDifferenceTool::CheckOpenGLCanDifference() > { >- if(GLEW_ARB_imaging) >+ if(epoxy_has_gl_extension("GL_ARB_imaging")) > return true; >- if((glBlendEquation!=NULL) && (GLEW_EXT_blend_subtract)) >+ if((glBlendEquation!=NULL) && (epoxy_has_gl_extension("GL_EXT_blend_subtract"))) > return true; > return false; > } >--- a/src/hugin1/hugin/PreviewIdentifyTool.cpp >+++ b/src/hugin1/hugin/PreviewIdentifyTool.cpp >@@ -31,14 +31,10 @@ > > #include <wx/platform.h> > >-//multitexture feature requires glew on some systems >-#include <GL/glew.h> >- >+#include <epoxy/gl.h> > #ifdef __WXMAC__ >-#include <OpenGL/gl.h> > #include <OpenGL/glu.h> > #else >-#include <GL/gl.h> > #include <GL/glu.h> > #endif
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 45876
: 13414