mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-05-10 01:20:50 +08:00
Coding - Fix CI compilation warnings (#1253)
Refactor NULL to nullptr in OpenGL-related files Fix some MacOS, Ubuntu warnings and disable too strict warning checks
This commit is contained in:
9
.github/actions/configure-occt/action.yml
vendored
9
.github/actions/configure-occt/action.yml
vendored
@@ -70,9 +70,9 @@ runs:
|
|||||||
brew update || true
|
brew update || true
|
||||||
# temporary workaround for missing tcl-tk
|
# temporary workaround for missing tcl-tk
|
||||||
brew install tcl-tk || true
|
brew install tcl-tk || true
|
||||||
# Force link any conflicting packages
|
# Force link any conflicting packages (only if the keg is installed)
|
||||||
brew link --overwrite python@3.12 || true
|
brew list python@3.12 >/dev/null 2>&1 && brew link --overwrite python@3.12 || true
|
||||||
brew link --overwrite python@3.13 || true
|
brew list python@3.13 >/dev/null 2>&1 && brew link --overwrite python@3.13 || true
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Configure OCCT (Windows)
|
- name: Configure OCCT (Windows)
|
||||||
@@ -152,7 +152,6 @@ runs:
|
|||||||
cmake -G "Unix Makefiles" \
|
cmake -G "Unix Makefiles" \
|
||||||
-D CMAKE_C_COMPILER=${{ inputs.compiler == 'clang' && 'clang' || 'gcc' }} \
|
-D CMAKE_C_COMPILER=${{ inputs.compiler == 'clang' && 'clang' || 'gcc' }} \
|
||||||
-D CMAKE_CXX_COMPILER=${{ inputs.compiler == 'clang' && 'clang++' || 'g++' }} \
|
-D CMAKE_CXX_COMPILER=${{ inputs.compiler == 'clang' && 'clang++' || 'g++' }} \
|
||||||
-D CMAKE_CXX_FLAGS="-Werror -Wzero-as-null-pointer-constant -Wno-unknown-warning-option -Wno-error=array-bounds -Wno-error=maybe-uninitialized -Wno-error=stringop-overflow -Wno-deprecated-declarations -Wno-error=cast-function-type-mismatch" \
|
|
||||||
-D BUILD_USE_PCH=${{ inputs.build-use-pch }} \
|
-D BUILD_USE_PCH=${{ inputs.build-use-pch }} \
|
||||||
-D BUILD_OPT_PROFILE=${{ inputs.build-opt-profile }} \
|
-D BUILD_OPT_PROFILE=${{ inputs.build-opt-profile }} \
|
||||||
-D BUILD_INCLUDE_SYMLINK=ON \
|
-D BUILD_INCLUDE_SYMLINK=ON \
|
||||||
@@ -168,6 +167,7 @@ runs:
|
|||||||
-D BUILD_GTEST=ON \
|
-D BUILD_GTEST=ON \
|
||||||
-D BUILD_CPP_STANDARD=C++17 \
|
-D BUILD_CPP_STANDARD=C++17 \
|
||||||
-D INSTALL_GTEST=ON \
|
-D INSTALL_GTEST=ON \
|
||||||
|
-D CMAKE_CXX_FLAGS="-Werror -Wall -Wextra -Wno-deprecated-declarations -Wno-unknown-warning-option -Wno-error=cast-function-type-mismatch" \
|
||||||
${{ inputs.additional-cmake-flags }} ..
|
${{ inputs.additional-cmake-flags }} ..
|
||||||
echo "Configuration completed successfully for macOS"
|
echo "Configuration completed successfully for macOS"
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -183,7 +183,6 @@ runs:
|
|||||||
cmake -G "Unix Makefiles" \
|
cmake -G "Unix Makefiles" \
|
||||||
-D CMAKE_C_COMPILER=${{ inputs.compiler == 'clang' && 'clang' || 'gcc' }} \
|
-D CMAKE_C_COMPILER=${{ inputs.compiler == 'clang' && 'clang' || 'gcc' }} \
|
||||||
-D CMAKE_CXX_COMPILER=${{ inputs.compiler == 'clang' && 'clang++' || 'g++' }} \
|
-D CMAKE_CXX_COMPILER=${{ inputs.compiler == 'clang' && 'clang++' || 'g++' }} \
|
||||||
-D CMAKE_CXX_FLAGS="-Werror -Wzero-as-null-pointer-constant -Wno-unknown-warning-option -Wno-error=array-bounds -Wno-error=maybe-uninitialized -Wno-error=stringop-overflow" \
|
|
||||||
-D BUILD_USE_PCH=${{ inputs.build-use-pch }} \
|
-D BUILD_USE_PCH=${{ inputs.build-use-pch }} \
|
||||||
-D BUILD_INCLUDE_SYMLINK=ON \
|
-D BUILD_INCLUDE_SYMLINK=ON \
|
||||||
-D BUILD_OPT_PROFILE=${{ inputs.build-opt-profile }} \
|
-D BUILD_OPT_PROFILE=${{ inputs.build-opt-profile }} \
|
||||||
|
|||||||
@@ -25,8 +25,8 @@
|
|||||||
#define FUNC (*((TheISurface*)(func)))
|
#define FUNC (*((TheISurface*)(func)))
|
||||||
|
|
||||||
IntImp_ZerImpFunc::IntImp_ZerImpFunc()
|
IntImp_ZerImpFunc::IntImp_ZerImpFunc()
|
||||||
: surf(NULL),
|
: surf(nullptr),
|
||||||
func(NULL),
|
func(nullptr),
|
||||||
u(0.0),
|
u(0.0),
|
||||||
v(0.0),
|
v(0.0),
|
||||||
tol(0.0),
|
tol(0.0),
|
||||||
@@ -55,7 +55,7 @@ IntImp_ZerImpFunc::IntImp_ZerImpFunc(const ThePSurface& PS, const TheISurface& I
|
|||||||
}
|
}
|
||||||
|
|
||||||
IntImp_ZerImpFunc::IntImp_ZerImpFunc(const TheISurface& IS)
|
IntImp_ZerImpFunc::IntImp_ZerImpFunc(const TheISurface& IS)
|
||||||
: surf(NULL),
|
: surf(nullptr),
|
||||||
u(0.0),
|
u(0.0),
|
||||||
v(0.0),
|
v(0.0),
|
||||||
tol(0.0),
|
tol(0.0),
|
||||||
|
|||||||
@@ -1005,7 +1005,7 @@ void PointProcess(const gp_Pnt& Pt,
|
|||||||
bool IsRegularity(const TheArc& /*A*/, const occ::handle<TheTopolTool>& aDomain)
|
bool IsRegularity(const TheArc& /*A*/, const occ::handle<TheTopolTool>& aDomain)
|
||||||
{
|
{
|
||||||
void* anEAddress = aDomain->Edge();
|
void* anEAddress = aDomain->Edge();
|
||||||
if (anEAddress == NULL)
|
if (anEAddress == nullptr)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1026,7 +1026,7 @@ int TreatLC(const TheArc& A,
|
|||||||
int anExitCode = 1, aNbExt;
|
int anExitCode = 1, aNbExt;
|
||||||
|
|
||||||
void* anEAddress = aDomain->Edge();
|
void* anEAddress = aDomain->Edge();
|
||||||
if (anEAddress == NULL)
|
if (anEAddress == nullptr)
|
||||||
{
|
{
|
||||||
return anExitCode;
|
return anExitCode;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ static void APIENTRY glGetTexLevelParameterfv(GLenum target,
|
|||||||
static void APIENTRY glGetPointerv(GLenum name, GLvoid** params)
|
static void APIENTRY glGetPointerv(GLenum name, GLvoid** params)
|
||||||
{
|
{
|
||||||
#if defined(GL_ES_VERSION_2_0)
|
#if defined(GL_ES_VERSION_2_0)
|
||||||
*params = NULL;
|
*params = nullptr;
|
||||||
::glEnable(0xFFFF); // added to OpenGL ES 3.2
|
::glEnable(0xFFFF); // added to OpenGL ES 3.2
|
||||||
(void)name;
|
(void)name;
|
||||||
#else
|
#else
|
||||||
@@ -1913,7 +1913,7 @@ void OpenGl_GlFunctions::load(OpenGl_Context& theCtx, bool theIsCoreProfile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(GL_ES_VERSION_2_0)
|
#if defined(GL_ES_VERSION_2_0)
|
||||||
theCtx.core11ffp = NULL;
|
theCtx.core11ffp = nullptr;
|
||||||
#else
|
#else
|
||||||
theCtx.core11ffp = !isCoreProfile ? (OpenGl_GlCore11*)this : nullptr;
|
theCtx.core11ffp = !isCoreProfile ? (OpenGl_GlCore11*)this : nullptr;
|
||||||
#endif
|
#endif
|
||||||
@@ -2065,7 +2065,7 @@ void OpenGl_GlFunctions::load(OpenGl_Context& theCtx, bool theIsCoreProfile)
|
|||||||
#ifndef __EMSCRIPTEN__
|
#ifndef __EMSCRIPTEN__
|
||||||
&& hasMapBufferRange
|
&& hasMapBufferRange
|
||||||
#endif
|
#endif
|
||||||
&& hasInstanced && theCtx.arbSamplerObject != NULL && theCtx.arbFBOBlit != NULL
|
&& hasInstanced && theCtx.arbSamplerObject != nullptr && theCtx.arbFBOBlit != nullptr
|
||||||
&& FindProcShort(glReadBuffer) && FindProcShort(glDrawRangeElements)
|
&& FindProcShort(glReadBuffer) && FindProcShort(glDrawRangeElements)
|
||||||
&& FindProcShort(glTexImage3D) && FindProcShort(glTexSubImage3D)
|
&& FindProcShort(glTexImage3D) && FindProcShort(glTexSubImage3D)
|
||||||
&& FindProcShort(glCopyTexSubImage3D) && FindProcShort(glCompressedTexImage3D)
|
&& FindProcShort(glCopyTexSubImage3D) && FindProcShort(glCompressedTexImage3D)
|
||||||
@@ -2161,7 +2161,7 @@ void OpenGl_GlFunctions::load(OpenGl_Context& theCtx, bool theIsCoreProfile)
|
|||||||
if (isGlGreaterEqualShort(3, 2) || checkExtensionShort("GL_KHR_debug"))
|
if (isGlGreaterEqualShort(3, 2) || checkExtensionShort("GL_KHR_debug"))
|
||||||
{
|
{
|
||||||
// this functionality become a part of OpenGL ES 3.2
|
// this functionality become a part of OpenGL ES 3.2
|
||||||
theCtx.arbDbg = NULL;
|
theCtx.arbDbg = nullptr;
|
||||||
if (isGlGreaterEqualShort(3, 2) && FindProcShort(glDebugMessageControl)
|
if (isGlGreaterEqualShort(3, 2) && FindProcShort(glDebugMessageControl)
|
||||||
&& FindProcShort(glDebugMessageInsert) && FindProcShort(glDebugMessageCallback)
|
&& FindProcShort(glDebugMessageInsert) && FindProcShort(glDebugMessageCallback)
|
||||||
&& FindProcShort(glGetDebugMessageLog))
|
&& FindProcShort(glGetDebugMessageLog))
|
||||||
@@ -2182,7 +2182,7 @@ void OpenGl_GlFunctions::load(OpenGl_Context& theCtx, bool theIsCoreProfile)
|
|||||||
|
|
||||||
// load OpenGL ES 3.2 new functions
|
// load OpenGL ES 3.2 new functions
|
||||||
const bool has32es =
|
const bool has32es =
|
||||||
isGlGreaterEqualShort(3, 2) && has31es && hasTexBuffer32 && theCtx.arbDbg != NULL
|
isGlGreaterEqualShort(3, 2) && has31es && hasTexBuffer32 && theCtx.arbDbg != nullptr
|
||||||
&& FindProcShort(glBlendBarrier) && FindProcShort(glCopyImageSubData)
|
&& FindProcShort(glBlendBarrier) && FindProcShort(glCopyImageSubData)
|
||||||
&& FindProcShort(glPushDebugGroup) && FindProcShort(glPopDebugGroup)
|
&& FindProcShort(glPushDebugGroup) && FindProcShort(glPopDebugGroup)
|
||||||
&& FindProcShort(glObjectLabel) && FindProcShort(glGetObjectLabel)
|
&& FindProcShort(glObjectLabel) && FindProcShort(glGetObjectLabel)
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ static const occ::handle<OpenGl_Context> TheNullGlCtx;
|
|||||||
//! Wrapper over eglChooseConfig() called with preferred defaults.
|
//! Wrapper over eglChooseConfig() called with preferred defaults.
|
||||||
static EGLConfig chooseEglSurfConfig(EGLDisplay theDisplay, const occ::handle<OpenGl_Caps>& theCaps)
|
static EGLConfig chooseEglSurfConfig(EGLDisplay theDisplay, const occ::handle<OpenGl_Caps>& theCaps)
|
||||||
{
|
{
|
||||||
EGLConfig aCfg = NULL;
|
EGLConfig aCfg = nullptr;
|
||||||
EGLint aNbConfigs = 0;
|
EGLint aNbConfigs = 0;
|
||||||
for (int aGlesVer = 3; aGlesVer >= 2; --aGlesVer)
|
for (int aGlesVer = 3; aGlesVer >= 2; --aGlesVer)
|
||||||
{
|
{
|
||||||
@@ -116,7 +116,7 @@ static EGLConfig chooseEglSurfConfig(EGLDisplay theDisplay, const occ::handle<Op
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (eglChooseConfig(theDisplay, aConfigAttribs, &aCfg, 1, &aNbConfigs) == EGL_TRUE
|
if (eglChooseConfig(theDisplay, aConfigAttribs, &aCfg, 1, &aNbConfigs) == EGL_TRUE
|
||||||
&& aCfg != NULL)
|
&& aCfg != nullptr)
|
||||||
{
|
{
|
||||||
return aCfg;
|
return aCfg;
|
||||||
}
|
}
|
||||||
@@ -129,7 +129,7 @@ static EGLConfig chooseEglSurfConfig(EGLDisplay theDisplay, const occ::handle<Op
|
|||||||
aConfigAttribs[1 * 2 + 1] = 8;
|
aConfigAttribs[1 * 2 + 1] = 8;
|
||||||
aConfigAttribs[2 * 2 + 1] = 8;
|
aConfigAttribs[2 * 2 + 1] = 8;
|
||||||
if (eglChooseConfig(theDisplay, aConfigAttribs, &aCfg, 1, &aNbConfigs) == EGL_TRUE
|
if (eglChooseConfig(theDisplay, aConfigAttribs, &aCfg, 1, &aNbConfigs) == EGL_TRUE
|
||||||
&& aCfg != NULL)
|
&& aCfg != nullptr)
|
||||||
{
|
{
|
||||||
return aCfg;
|
return aCfg;
|
||||||
}
|
}
|
||||||
@@ -140,7 +140,7 @@ static EGLConfig chooseEglSurfConfig(EGLDisplay theDisplay, const occ::handle<Op
|
|||||||
// try config with smaller depth buffer
|
// try config with smaller depth buffer
|
||||||
aConfigAttribs[4 * 2 + 1] = 16;
|
aConfigAttribs[4 * 2 + 1] = 16;
|
||||||
if (eglChooseConfig(theDisplay, aConfigAttribs, &aCfg, 1, &aNbConfigs) == EGL_TRUE
|
if (eglChooseConfig(theDisplay, aConfigAttribs, &aCfg, 1, &aNbConfigs) == EGL_TRUE
|
||||||
&& aCfg != NULL)
|
&& aCfg != nullptr)
|
||||||
{
|
{
|
||||||
return aCfg;
|
return aCfg;
|
||||||
}
|
}
|
||||||
@@ -305,7 +305,7 @@ void OpenGl_GraphicDriver::ReleaseContext()
|
|||||||
|
|
||||||
myEglDisplay = (Aspect_Display)EGL_NO_DISPLAY;
|
myEglDisplay = (Aspect_Display)EGL_NO_DISPLAY;
|
||||||
myEglContext = (Aspect_RenderingContext)EGL_NO_CONTEXT;
|
myEglContext = (Aspect_RenderingContext)EGL_NO_CONTEXT;
|
||||||
myEglConfig = NULL;
|
myEglConfig = nullptr;
|
||||||
#endif
|
#endif
|
||||||
myIsOwnContext = false;
|
myIsOwnContext = false;
|
||||||
}
|
}
|
||||||
@@ -342,7 +342,7 @@ bool OpenGl_GraphicDriver::InitContext()
|
|||||||
}
|
}
|
||||||
|
|
||||||
myEglConfig = chooseEglSurfConfig((EGLDisplay)myEglDisplay, myCaps);
|
myEglConfig = chooseEglSurfConfig((EGLDisplay)myEglDisplay, myCaps);
|
||||||
if (myEglConfig == NULL)
|
if (myEglConfig == nullptr)
|
||||||
{
|
{
|
||||||
::Message::SendFail("Error: EGL does not provide compatible configurations");
|
::Message::SendFail("Error: EGL does not provide compatible configurations");
|
||||||
return false;
|
return false;
|
||||||
@@ -367,7 +367,7 @@ bool OpenGl_GraphicDriver::InitContext()
|
|||||||
eglCreateContext((EGLDisplay)myEglDisplay, myEglConfig, EGL_NO_CONTEXT, anEglCtxAttribs2);
|
eglCreateContext((EGLDisplay)myEglDisplay, myEglConfig, EGL_NO_CONTEXT, anEglCtxAttribs2);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
EGLint* anEglCtxAttribs = NULL;
|
EGLint* anEglCtxAttribs = nullptr;
|
||||||
if (eglBindAPI(EGL_OPENGL_API) != EGL_TRUE)
|
if (eglBindAPI(EGL_OPENGL_API) != EGL_TRUE)
|
||||||
{
|
{
|
||||||
::Message::SendFail("Error: EGL does not provide OpenGL client");
|
::Message::SendFail("Error: EGL does not provide OpenGL client");
|
||||||
@@ -417,10 +417,10 @@ bool OpenGl_GraphicDriver::InitEglContext(Aspect_Display theEglDisplay,
|
|||||||
myEglDisplay = theEglDisplay;
|
myEglDisplay = theEglDisplay;
|
||||||
myEglContext = theEglContext;
|
myEglContext = theEglContext;
|
||||||
myEglConfig = theEglConfig;
|
myEglConfig = theEglConfig;
|
||||||
if (theEglConfig == NULL)
|
if (theEglConfig == nullptr)
|
||||||
{
|
{
|
||||||
myEglConfig = chooseEglSurfConfig((EGLDisplay)myEglDisplay, myCaps);
|
myEglConfig = chooseEglSurfConfig((EGLDisplay)myEglDisplay, myCaps);
|
||||||
if (myEglConfig == NULL)
|
if (myEglConfig == nullptr)
|
||||||
{
|
{
|
||||||
::Message::SendFail("Error: EGL does not provide compatible configurations");
|
::Message::SendFail("Error: EGL does not provide compatible configurations");
|
||||||
return false;
|
return false;
|
||||||
@@ -454,7 +454,7 @@ void OpenGl_GraphicDriver::chooseVisualInfo()
|
|||||||
XVisualInfo aVisInfoTmp;
|
XVisualInfo aVisInfoTmp;
|
||||||
memset(&aVisInfoTmp, 0, sizeof(aVisInfoTmp));
|
memset(&aVisInfoTmp, 0, sizeof(aVisInfoTmp));
|
||||||
aVisInfoTmp.screen = DefaultScreen(aDisp);
|
aVisInfoTmp.screen = DefaultScreen(aDisp);
|
||||||
if (myEglDisplay != EGL_NO_DISPLAY && myEglConfig != NULL
|
if (myEglDisplay != EGL_NO_DISPLAY && myEglConfig != nullptr
|
||||||
&& eglGetConfigAttrib((EGLDisplay)myEglDisplay,
|
&& eglGetConfigAttrib((EGLDisplay)myEglDisplay,
|
||||||
myEglConfig,
|
myEglConfig,
|
||||||
EGL_NATIVE_VISUAL_ID,
|
EGL_NATIVE_VISUAL_ID,
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ void OpenGl_Window::Init(const occ::handle<OpenGl_GraphicDriver>& theDriver,
|
|||||||
EGLContext anEglContext = (EGLContext)theDriver->getRawGlContext();
|
EGLContext anEglContext = (EGLContext)theDriver->getRawGlContext();
|
||||||
EGLConfig anEglConfig = (EGLConfig)theDriver->getRawGlConfig();
|
EGLConfig anEglConfig = (EGLConfig)theDriver->getRawGlConfig();
|
||||||
if (anEglDisplay == EGL_NO_DISPLAY || anEglContext == EGL_NO_CONTEXT
|
if (anEglDisplay == EGL_NO_DISPLAY || anEglContext == EGL_NO_CONTEXT
|
||||||
|| (anEglConfig == NULL && (EGLContext)theGContext == EGL_NO_CONTEXT))
|
|| (anEglConfig == nullptr && (EGLContext)theGContext == EGL_NO_CONTEXT))
|
||||||
{
|
{
|
||||||
throw Aspect_GraphicDeviceDefinitionError(
|
throw Aspect_GraphicDeviceDefinitionError(
|
||||||
"OpenGl_Window, EGL does not provide compatible configurations!");
|
"OpenGl_Window, EGL does not provide compatible configurations!");
|
||||||
@@ -215,7 +215,7 @@ void OpenGl_Window::Init(const occ::handle<OpenGl_GraphicDriver>& theDriver,
|
|||||||
anEglSurf = eglCreateWindowSurface(anEglDisplay,
|
anEglSurf = eglCreateWindowSurface(anEglDisplay,
|
||||||
anEglConfig,
|
anEglConfig,
|
||||||
(EGLNativeWindowType)myPlatformWindow->NativeHandle(),
|
(EGLNativeWindowType)myPlatformWindow->NativeHandle(),
|
||||||
NULL);
|
nullptr);
|
||||||
if (anEglSurf == EGL_NO_SURFACE && myPlatformWindow->NativeHandle() != 0)
|
if (anEglSurf == EGL_NO_SURFACE && myPlatformWindow->NativeHandle() != 0)
|
||||||
{
|
{
|
||||||
throw Aspect_GraphicDeviceDefinitionError(
|
throw Aspect_GraphicDeviceDefinitionError(
|
||||||
@@ -226,7 +226,7 @@ void OpenGl_Window::Init(const occ::handle<OpenGl_GraphicDriver>& theDriver,
|
|||||||
// window-less EGL context (off-screen)
|
// window-less EGL context (off-screen)
|
||||||
// throw Aspect_GraphicDeviceDefinitionError("OpenGl_Window, EGL is unable to retrieve current
|
// throw Aspect_GraphicDeviceDefinitionError("OpenGl_Window, EGL is unable to retrieve current
|
||||||
// surface!");
|
// surface!");
|
||||||
if (anEglConfig != NULL)
|
if (anEglConfig != nullptr)
|
||||||
{
|
{
|
||||||
#if !defined(__EMSCRIPTEN__) // eglCreatePbufferSurface() is not implemented by Emscripten EGL
|
#if !defined(__EMSCRIPTEN__) // eglCreatePbufferSurface() is not implemented by Emscripten EGL
|
||||||
const int aSurfAttribs[] = {EGL_WIDTH,
|
const int aSurfAttribs[] = {EGL_WIDTH,
|
||||||
@@ -267,7 +267,7 @@ void OpenGl_Window::Init(const occ::handle<OpenGl_GraphicDriver>& theDriver,
|
|||||||
// window-less EGL context (off-screen)
|
// window-less EGL context (off-screen)
|
||||||
// throw Aspect_GraphicDeviceDefinitionError("OpenGl_Window, EGL is unable to retrieve current
|
// throw Aspect_GraphicDeviceDefinitionError("OpenGl_Window, EGL is unable to retrieve current
|
||||||
// surface!");
|
// surface!");
|
||||||
if (anEglConfig != NULL)
|
if (anEglConfig != nullptr)
|
||||||
{
|
{
|
||||||
#if !defined(__EMSCRIPTEN__) // eglCreatePbufferSurface() is not implemented by Emscripten EGL
|
#if !defined(__EMSCRIPTEN__) // eglCreatePbufferSurface() is not implemented by Emscripten EGL
|
||||||
const int aSurfAttribs[] = {EGL_WIDTH,
|
const int aSurfAttribs[] = {EGL_WIDTH,
|
||||||
|
|||||||
@@ -136,10 +136,10 @@ void OpenGl_Window::Init (const occ::handle<OpenGl_GraphicDriver>& theDriver,
|
|||||||
Cocoa_LocalPool aLocalPool;
|
Cocoa_LocalPool aLocalPool;
|
||||||
|
|
||||||
// all GL context within one OpenGl_GraphicDriver should be shared!
|
// all GL context within one OpenGl_GraphicDriver should be shared!
|
||||||
NSOpenGLContext* aGLCtxShare = theShareCtx.IsNull() ? NULL : theShareCtx->myGContext;
|
NSOpenGLContext* aGLCtxShare = theShareCtx.IsNull() ? nullptr : theShareCtx->myGContext;
|
||||||
NSOpenGLContext* aGLContext = theGContext;
|
NSOpenGLContext* aGLContext = theGContext;
|
||||||
bool isCore = false;
|
bool isCore = false;
|
||||||
if (aGLContext == NULL)
|
if (aGLContext == nullptr)
|
||||||
{
|
{
|
||||||
NSOpenGLPixelFormatAttribute anAttribs[32] = {};
|
NSOpenGLPixelFormatAttribute anAttribs[32] = {};
|
||||||
int aLastAttrib = 0;
|
int aLastAttrib = 0;
|
||||||
@@ -195,19 +195,19 @@ void OpenGl_Window::Init (const occ::handle<OpenGl_GraphicDriver>& theDriver,
|
|||||||
NSOpenGLPixelFormat* aGLFormat = [[[NSOpenGLPixelFormat alloc] initWithAttributes: anAttribs] autorelease];
|
NSOpenGLPixelFormat* aGLFormat = [[[NSOpenGLPixelFormat alloc] initWithAttributes: anAttribs] autorelease];
|
||||||
aGLContext = [[NSOpenGLContext alloc] initWithFormat: aGLFormat
|
aGLContext = [[NSOpenGLContext alloc] initWithFormat: aGLFormat
|
||||||
shareContext: aGLCtxShare];
|
shareContext: aGLCtxShare];
|
||||||
if (aGLContext != NULL)
|
if (aGLContext != nullptr)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aGLContext != NULL)
|
if (aGLContext != nullptr)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aGLContext == NULL)
|
if (aGLContext == nullptr)
|
||||||
{
|
{
|
||||||
TCollection_AsciiString aMsg ("OpenGl_Window::CreateWindow: NSOpenGLContext creation failed");
|
TCollection_AsciiString aMsg ("OpenGl_Window::CreateWindow: NSOpenGLContext creation failed");
|
||||||
throw Aspect_GraphicDeviceDefinitionError(aMsg.ToCString());
|
throw Aspect_GraphicDeviceDefinitionError(aMsg.ToCString());
|
||||||
@@ -402,7 +402,7 @@ void OpenGl_Window::init()
|
|||||||
const int aViewport[4] = { 0, 0, mySize.x(), mySize.y() };
|
const int aViewport[4] = { 0, 0, mySize.x(), mySize.y() };
|
||||||
myGlContext->ResizeViewport (aViewport);
|
myGlContext->ResizeViewport (aViewport);
|
||||||
myGlContext->SetDrawBuffer (GL_BACK);
|
myGlContext->SetDrawBuffer (GL_BACK);
|
||||||
if (myGlContext->core11ffp != NULL)
|
if (myGlContext->core11ffp != nullptr)
|
||||||
{
|
{
|
||||||
myGlContext->core11ffp->glMatrixMode (GL_MODELVIEW);
|
myGlContext->core11ffp->glMatrixMode (GL_MODELVIEW);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ public:
|
|||||||
virtual Aspect_Drawable NativeParentHandle() const override { return 0; }
|
virtual Aspect_Drawable NativeParentHandle() const override { return 0; }
|
||||||
|
|
||||||
//! Returns nothing on OS X
|
//! Returns nothing on OS X
|
||||||
virtual Aspect_FBConfig NativeFBConfig() const override { return NULL; }
|
virtual Aspect_FBConfig NativeFBConfig() const override { return nullptr; }
|
||||||
|
|
||||||
//! Sets window title.
|
//! Sets window title.
|
||||||
Standard_EXPORT virtual void SetTitle(const TCollection_AsciiString& theTitle) override;
|
Standard_EXPORT virtual void SetTitle(const TCollection_AsciiString& theTitle) override;
|
||||||
@@ -135,7 +135,7 @@ public:
|
|||||||
//! Invalidate entire window content by setting NSView::setNeedsDisplay property.
|
//! Invalidate entire window content by setting NSView::setNeedsDisplay property.
|
||||||
//! Call will be implicitly redirected to the main thread when called from non-GUI thread.
|
//! Call will be implicitly redirected to the main thread when called from non-GUI thread.
|
||||||
Standard_EXPORT virtual void InvalidateContent(
|
Standard_EXPORT virtual void InvalidateContent(
|
||||||
const occ::handle<Aspect_DisplayConnection>& theDisp = NULL) override;
|
const occ::handle<Aspect_DisplayConnection>& theDisp = nullptr) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
|
#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
|
||||||
|
|||||||
Reference in New Issue
Block a user