Tue, 11/05/2024 - 10:06
Hello, I am using ubuntu 24.04, when starting a occ+qt base app,and debugging goes into a mobile branch,namely in
OpenGl_Context.cxx from line 954
Standard_Boolean OpenGl_Context::Init (const Standard_Boolean theIsCoreProfile)
{
......
#if defined(HAVE_EGL)
......Debugging goes into here......
......Debugging goes into here......
......Debugging goes into here......
#elif defined(_WIN32)
......
#elif defined(HAVE_XLIB)
....
#else
//
#endif
....
}
Based on occ doc, "HAVE_EGL" means "GLES based systems like iOS or Android". I have tried to add below two lines before creating OpenGL_Context
#def HAVE_EGL
#define HAVE_XLIB
but debugging still goes to the first branch.
And in the same machine, another occ base app runs fine and the debugging goes into the third branch which is guarded by "HAVE_XLIB".
Would you please give me some hints about how to fix this issue?
Tue, 11/05/2024 - 13:43
This is not precisely correct. On mobile systems there is just no alternative to EGL and GLES.
On desktop platforms, it is possible activating
USE_GLESwhich would activate buildingTKOpenGleslibrary and implicitly rely onEGL(there is no useful alternative for creatingGLEScontext usingGLX,WGLor whatever).On desktop Linux system you may specify
USE_XLIBto useXw_Windowand rely onGLXforTKOpenGltoolkit, otherwise it will useEGLfor creating desktop OpenGL context (but you will need creating window yourself; DRAWEXE will be able to create only offscreen EGL context for creating screenshots).Note that both
TKOpenGlandTKOpenGlesexport classes likeOpenGl_GraphicDriverwith the same name, hence which implementation to use will depend on which library your application is linked against.I don't quite understand what you're trying to achieve by redefining some macros locally, as these should depend on OCCT building configuration (and will vary depending on
TKOpenGlorTKOpenGlestarget, as both reuse common source code - hence you may experience weird behavior in debugger, if you have linked another toolkit that you don't expect).Tue, 11/05/2024 - 14:12
Thanks for helping, the three branches are like this:
#if defined(HAVE_EGL)
myDisplay = (Aspect_Display )eglGetCurrentDisplay();
myGContext = (Aspect_RenderingContext )eglGetCurrentContext();
myWindow = (Aspect_Drawable )eglGetCurrentSurface(EGL_DRAW);
#elif defined(_WIN32)
.....
#elif defined(HAVE_XLIB)
myDisplay = (Aspect_Display )glXGetCurrentDisplay();
myGContext = (Aspect_RenderingContext )glXGetCurrentContext();
myWindow = (Aspect_Drawable )glXGetCurrentDrawable();
#else
And if debugging goes into the first branch(HAVE_EGL),
myGContext will be a nullptr
And in the same machine with same IDE and same building steps, using same OCC libs, another OCC based app's debugging thread will go to the third branch(HAVE_XLIB),and runs fine, so I doubt that other libs or cmake entries interfered OCC lib,so I tried to redefining some macros locally.
Wed, 11/06/2024 - 04:18
Seems like after removing the TKOpengles,everything worked