CEGUI: не удалось получить версию OpenGL для ПК

Среда:

Код:

CEGUI::OpenGL3Renderer& myRenderer = CEGUI::OpenGL3Renderer::bootstrapSystem();

Ошибка:

CEGUI :: RendererException в функции ‘void
CEGUI :: OpenGLInfo :: initTypeAndVer ()»
(/Home/jay/tmp/cegui/cegui-0.8.7/cegui/src/RendererModules/OpenGL/GL.cpp:88)
: Не удалось получить версию OpenGL для ПК. прекратить называется после
выдает экземпляр CEGUI :: RendererException what ():
CEGUI :: RendererException в функции ‘void
CEGUI :: OpenGLInfo :: initTypeAndVer ()»
(/Home/jay/tmp/cegui/cegui-0.8.7/cegui/src/RendererModules/OpenGL/GL.cpp:88)
: Не удалось получить версию OpenGL для ПК.

Включить из заголовочного файла:

#include <epoxy/gl.h>

На всякий случай это полезно. Вот вывод команды cmake, чтобы показать, что он смог найти, а что нет:

sudo cmake .. -DCEGUI_BUILD_RENDERER_OPENGL=OFF -DCEGUI_BUILD_RENDERER_OPENGL3=ON -DCEGUI_USE_EPOXY=ON -DCEGUI_USE_GLEW=OFF
CMake Deprecation Warning at CMakeLists.txt:6 (cmake_policy):
The OLD behavior for policy CMP0017 will be removed from a future version
of CMake.

The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.-- The C compiler identification is GNU 7.2.1
-- The CXX compiler identification is GNU 7.2.1
-- Check for working C compiler: /bin/cc
-- Check for working C compiler: /bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /bin/c++
-- Check for working CXX compiler: /bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PCRE: /usr/lib64/libpcre.so
-- Found FREETYPE: /usr/lib64/libfreetype.so
-- Found MINIZIP: /usr/lib64/libminizip.so
-- Found PkgConfig: /bin/pkg-config (found version "1.3.12")
-- Checking for module 'fribidi'
-- Found fribidi, version 0.19.7
-- Found FRIBIDI: TRUE
-- Looking for iconv
-- Looking for iconv - found
-- Found OpenGL: /usr/lib64/libOpenGL.so
-- Found GLEW: /usr/lib64/libGLEW.so
-- Found GLM: /usr/include
-- Could NOT find GLFW (missing: GLFW_H_PATH)
-- Found GLFW3: /usr/lib64/libglfw.so
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found SDL2: /usr/lib64/libSDL2.so;-lpthread
-- Found SDL2IMAGE: /usr/lib64/libSDL2_image.so
-- Could NOT find DIRECTXSDK (missing: DIRECTXSDK_LIB_PATH DIRECTXSDK_H_PATH DIRECTXSDK_MAX_D3D)
-- Could NOT find D3DX11EFFECTS (missing: D3DX11EFFECTS_LIB D3DX11EFFECTS_H_PATH)
-- Found IRRLICHT: /usr/lib64/libIrrlicht.so
-- Could NOT find OGRE (missing: OGRE_LIB OGRE_H_PATH OGRE_H_BUILD_SETTINGS_PATH)
-- Found OIS: /usr/lib64/libOIS.so
-- Could NOT find DIRECTFB (missing: DIRECTFB_LIB DIRECTFB_H_PATH)
-- Could NOT find OPENGLES (missing: OPENGLES_LIB OPENGLES_H_PATH)
-- Found EPOXY: /usr/local/lib64/libepoxy.so
-- Found EXPAT: /usr/lib64/libexpat.so
-- Could NOT find XERCESC (missing: XERCESC_LIB XERCESC_H_PATH)
-- Found LibXml2: /usr/lib64/libxml2.so (found version "2.9.4")
-- Found TINYXML: /usr/lib64/libtinyxml.so
-- Performing Test TINYXML_API_TEST
-- Performing Test TINYXML_API_TEST - Success
-- Could NOT find RAPIDXML (missing: RAPIDXML_H_PATH)
-- Could NOT find IL (missing: IL_LIB IL_H_PATH)
-- Could NOT find ILU (missing: ILU_LIB)
-- Found FREEIMAGE: /usr/lib64/libfreeimage.so
-- Found SILLY: /usr/lib64/libSILLY.so
-- Could NOT find CORONA (missing: CORONA_LIB CORONA_H_PATH)
-- Could NOT find PVRTOOLS (missing: PVRTOOLS_LIB PVRTOOLS_H_PATH)
-- Found LUA51: /usr/lib64/liblua.so
-- Found TOLUAPP: /usr/lib64/libtolua++.so
-- Found PythonInterp: /bin/python (found version "2.7.14")
-- Found PythonLibs: //lib64/libpython2.7.so (found suitable exact version "2.7.14")
-- Boost version: 1.63.0
-- Found the following Boost libraries:
-- python
-- unit_test_framework
-- system
-- timer
-- Found Doxygen: /bin/doxygen (found version "1.8.13") found components: doxygen missing components: dot
-- Found GTK2_GTK: /usr/lib64/libgtk-x11-2.0.so
-- Configuring done
-- Generating done
-- Build files have been written to: xxx

0

Решение

Мне удалось решить эту проблему, и я хотел поделиться тем, что работало для меня.

Проблема заключалась в том, что эпоксидная смола не находила активный контекст. В настоящее время OSG не устанавливает открытый у вас контекст (который может быть вашим единственным контекстом) в качестве текущего контекста. Вы должны вручную установить его в качестве текущего контекста следующим образом:

// You will need to have realized the viewer at least once
viewer.realize();
// You can get your camera's primary context by calling getGraphicsContext
// on it. I then also called realize on it. I'm not 100% certain if this
// is necessary, but it seemed to .
viewer.getCamera()->getGraphicsContext()->realize();
// Set the GraphicsContext as the current GraphicsContext.
viewer.getCamera()->getGraphicsContext()->makeCurrent();

Эпоксидная смола теперь видит текущий контекст, и эта ошибка исчезает.

0

Другие решения

Других решений пока нет …