Failed to obtain desktop OpenGL version

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: Failed to obtain desktop OpenGL version

Postby YaronCT » Sun Jan 14, 2018 20:47

Returning 0 as OpenGL version does indeed indicate failure.

Just to be clear: You should file an issue for Epoxy, not for CEGUI... And that issue mustn't contain anything other than initializing OpenGL and calling epoxy_gl_version (and it certainly shouldn't use CEGUI!)

Note though, if you're looking for a solution soon, I'd advise you to debug it yourself...

jay74
Just popping in
Just popping in
Posts: 19
Joined: Sun Jan 07, 2018 19:23

Re: Failed to obtain desktop OpenGL version

Postby jay74 » Sun Jan 14, 2018 20:57

One last data point:
OpenGL version string: 3.0 Mesa 17.2.4

jay74
Just popping in
Just popping in
Posts: 19
Joined: Sun Jan 07, 2018 19:23

Re: Failed to obtain desktop OpenGL version

Postby jay74 » Sun Jan 14, 2018 21:08

Here's my test application. Output:
Epoxy GL Version: '0'
Epoxy GL Version: '0'

main.cpp

Code: Select all

#include "../headers/main.hpp"

int main( int argc, char** argv )
{
    osgViewer::Viewer viewer;
    int my_gl_version;

    viewer.setSceneData( osgDB::readNodeFile("cessna.osg") );
   
    viewer.realize();
   
    my_gl_version = epoxy_gl_version();
   
    cout << "Epoxy GL Version: '" << my_gl_version << "'" << endl;
   
    viewer.run();

    my_gl_version = epoxy_gl_version();
   
    cout << "Epoxy GL Version: '" << my_gl_version << "'" << endl;
   
    return my_gl_version;
}


main.hpp

Code: Select all

#ifndef MAIN_H
#define MAIN_H

#include <epoxy/gl.h>
#include <osgDB/ReadFile>
#include <osgViewer/Viewer>
#include <iostream>

using std::cout;
using std::endl;

#endif


CMakeLists.txt

Code: Select all

cmake_minimum_required( VERSION 3.1 )
project( MyProject )

set (CMAKE_CXX_STANDARD 11)

find_package( OpenThreads )
find_package( osg )
find_package( osgDB )
find_package( osgGA )
find_package( osgUtil )
find_package( osgViewer )
find_package( osgAnimation )
find_package( GTest )

macro( config_project PROJNAME LIBNAME )
    include_directories( ${${LIBNAME}_INCLUDE_DIR} )
    target_link_libraries( ${PROJNAME} ${${LIBNAME}_LIBRARY} )
endmacro()

set( GCC_SYMBOLS_PRIVATE_EXTERN "NO" )
set( GCC_INLINES_ARE_PRIVATE_EXTERN "NO" )

include_directories( /usr/local/include/epoxy )
include_directories( ../headers/ )

set( EPOXY_LIBRARIES
    libepoxy.so
)

link_directories( /usr/local/lib64 )

set( SOURCES
    ../src/main.cpp
)

set( HEADER_FILES
    ../headers/main.hpp
)

add_library( MyProjectLibs ${SOURCES} )

add_executable( MyProject ../src/main.cpp ${SOURCE} ${HEADER_FILES} )

target_link_libraries( MyProject MyProjectLibs ${EPOXY_LIBRARIES} )

config_project( MyProject OPENTHREADS )
config_project( MyProject OSG )
config_project( MyProject OSGDB )
config_project( MyProject OSGGA )
config_project( MyProject OSGUTIL )
config_project( MyProject OSGVIEWER )
config_project( MyProject OSGANIMATION )

jay74
Just popping in
Just popping in
Posts: 19
Joined: Sun Jan 07, 2018 19:23

Re: Failed to obtain desktop OpenGL version

Postby jay74 » Tue Jan 16, 2018 01:55

So, the reason why epoxy_gl_version() was returning zero was because OSG didn't set the only created context to the current context. I guess I assumed that since there was only one context that it would pick that context. I fixed that by setting it as the current context.

Code: Select all

   
    viewer.realize();
    viewer.getCamera()->getGraphicsContext()->realize();
    viewer.getCamera()->getGraphicsContext()->makeCurrent();


Now, instead of epoxy_gl_version() returning zero, it now returns '30'. However, now I'm getting a new error when I hit:

Code: Select all

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


Erorr:
Couldn't find current GLX or EGL context.


Do you have any wisdom on how I should go forward? Epoxy is now seeing the context, but I seem to have trouble making CEGUI aware of it. I can open a new forum post if you think that is wisest.

Thank you again,
Jay

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: Failed to obtain desktop OpenGL version

Postby YaronCT » Tue Jan 16, 2018 07:58

That error message is printed by Epoxy, not cegui (I simply looked for it on both code bases and it appears only in Epoxy). So again, I guess it's you and Epoxy, my friend... Unless you can show it's a cegui specific issue that you can't reproduce otherwise.

Note, though, while your configuration is valid, Mesa isn't a standard configuration, and OpenGL 3.0 isn't standard either (officially CEGUI OpenGL 3 renderer requires at least OpenGL 3.2). It says on the Mesa homepage they already support OpenGL 4.3, why do you use 3.0 then? Are you using a virtual machine or WINE perhaps?

jay74
Just popping in
Just popping in
Posts: 19
Joined: Sun Jan 07, 2018 19:23

Re: Failed to obtain desktop OpenGL version

Postby jay74 » Tue Jan 16, 2018 21:46

No particular reason. I guess it is what installed when I typed "sudo yum install ....". What version of OpenGL do you recommend that I use? Should I try and go for OpenGL 4.3? I'm going for the path of least resistance right now because I'm not doing anything too fancy.

Thank you again for your assistance. I really appreciate it.
-Jay

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: Failed to obtain desktop OpenGL version

Postby YaronCT » Tue Jan 16, 2018 22:15

NP...

If you're not using WINE or a virtual machine, and you have a graphics card capable of OpenGL >=3.2, why not use it? Mesa is an OpenGL emulator, if there's no need to use it, y use it?

You should generally use the least OpenGL version that supports everything you wanna use. However, if you wanna use the cegui OpenGL 3 renderer, again, the minimum official supported version is 3.2, so I'd start with that. OpenGL versions 3.0 and 3.1 were kind of wip and I see no reason to use them today unless necessary.

jay74
Just popping in
Just popping in
Posts: 19
Joined: Sun Jan 07, 2018 19:23

Re: Failed to obtain desktop OpenGL version

Postby jay74 » Tue Jan 16, 2018 23:13

I'm guessing then that my computer cannot support OpenGL greater than 3.0. It is an integrated Intel graphics card on a relatively old Dell.

I ran another grep on glxinfo just to get everything related to OpenGL and this was the output.
$ glxinfo | grep -i "Opengl"
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Sandybridge Mobile
OpenGL core profile version string: 3.3 (Core Profile) Mesa 17.2.4
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 17.2.4
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 17.2.4
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00
OpenGL ES profile extensions:


For good measure I also went to Intel and grabbed the intel-linux-graphics-installer just case. I ran the installer, rebooted my machine, and the output from the grep was the same. So, my system probably uses Mesa because of the integrated graphics card. The version of Mesa on my system is 17.2.4 which is from last October as far as I recall. That version supported up to OpenGL 4.5 ( if I read the documentation correctly ).

My understanding then is that I'm not using >=3.2 because my computer can't support it. I'll give the OpenGL 1.2 ( Older Desktop ) bootstrap a try.

If I'm missing something that the output from above actually indicates that I can support 3.2+, please let me know.

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: Failed to obtain desktop OpenGL version

Postby YaronCT » Wed Jan 17, 2018 06:47

I'm not an expert in that, I believe you should ask maybe in some linux forum, but to me it seems a bit weird your system should use Mesa, and weirder that it uses Mesa that supports only OpenGL 3.0 When Mesa already supports 4.3 or 4.5. However I still see it says "OpenGL core profile version string: 3.3" So I'm kind of confused, maybe it supports 3.3? I believe you should just try, if you can run an example program with OpenGL 3.2 or 3.3 (you can maybe try some sample GLFW program, it's very simple) then it probably works. Still Mesa is just an emulation. If your graphics card doesn't support OpenGL 3, I'm sure it still supports OpenGL 1 or 2 natively (so maybe it uses Mesa only for OpenGL versions it doesn't natively support?), so I believe unless you need specific OpenGL >=3 capabilities you're better off with OpenGL 1 or 2 and the cegui OpenGL 1 Renderer, which is probably better because it'll lower the minimum system requirements of your app. In general your app should require the minimum system requirements that you need, in order to supports systems as diverse and as old as possible.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 2 guests