This document provides technical details on changes made in particular versions of OCCT. It can help to upgrade user applications based on previous versions of OCCT to newer ones.
+@ref upgrade_occt770 "SEEK TO THE LAST CHAPTER (UPGRADE TO 7.7.0)"
+
@subsection upgrade_intro_precautions Precautions
Back-up your code before the upgrade.
It is your responsibility to ensure that the changes you made in your code are correct.
When you upgrade the code by an automatic script, make sure to carefully review the introduced changes at each step before committing them.
-
@section upgrade_65 Upgrade to OCCT 6.5.0
Porting of user applications from an earlier OCCT version to version 6.5 requires taking into account the following major changes:
`Prs3d_Drawer` getters no more implicitly create "default" aspects.
If specific property has not been set before to this drawer instance nor to linked drawer instance, then NULL property will be returned.
Make sure to set property beforehand or to call `SetOwn*` / `SetupOwn*` methods to derive from defaults.
+
+@subsection upgrade_occt770_opengl OpenGL functions
+
+Applications extending OCCT 3D Viewer and calling OpenGL functions directly (like @c @::glEnable(), e.g. using global namespace) might be affected by changes in `OpenGl_GlFunctions.hxx`.
+This header, as well as `OpenGl_GlCore20.hxx` and similar, no more include system OpenGL / OpenGL ES headers to define function table.
+Application code calling OpenGL functions directly should be changed to either use `OpenGl_Context::core11fwd` (as designed)
+or to include system OpenGL headers in advance (with help of `OpenGl_GlNative.hxx`).
// =======================================================================
void D3DHost_FrameBuffer::Release (OpenGl_Context* theCtx)
{
-#if !defined(GL_ES_VERSION_2_0)
if (myGlD3dDevice != NULL)
{
const OpenGl_GlFunctions* aFuncs = (theCtx != NULL && theCtx->IsValid())
}
myGlD3dDevice = NULL;
}
-#endif
if (myD3dSurf != NULL)
{
const Standard_Integer theDepthFormat)
{
Release (theCtx.operator->());
-#if !defined(GL_ES_VERSION_2_0)
+
myDepthFormat = theDepthFormat;
myVPSizeX = theSizeX;
myVPSizeY = theSizeY;
myD3dFallback = Standard_False;
return Standard_True;
-#else
- (void )theD3DDevice;
- (void )theIsD3dEx;
- (void )theSizeX;
- (void )theSizeY;
- (void )theDepthFormat;
- return Standard_False;
-#endif
}
// =======================================================================
// =======================================================================
Standard_Boolean D3DHost_FrameBuffer::registerD3dBuffer (const Handle(OpenGl_Context)& theCtx)
{
-#if defined(GL_ES_VERSION_2_0)
- (void )theCtx;
- return Standard_False;
-#else
const OpenGl_GlFunctions* aFuncs = theCtx->Functions();
if (myGlD3dSurf != NULL)
{
}
return Standard_True;
-#endif
}
// =======================================================================
const OpenGl_TextureFormat aDepthFormat = OpenGl_TextureFormat::FindSizedFormat (theCtx, myDepthFormat);
if (myDepthStencilTexture->IsValid())
{
- #ifdef GL_DEPTH_STENCIL_ATTACHMENT
theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, aDepthFormat.PixelFormat() == GL_DEPTH_STENCIL ? GL_DEPTH_STENCIL_ATTACHMENT : GL_DEPTH_ATTACHMENT,
myDepthStencilTexture->GetTarget(), myDepthStencilTexture->TextureId(), 0);
- #else
- theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
- myDepthStencilTexture->GetTarget(), myDepthStencilTexture->TextureId(), 0);
- if (aDepthFormat.PixelFormat() == GL_DEPTH_STENCIL)
- {
- theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
- myDepthStencilTexture->GetTarget(), myDepthStencilTexture->TextureId(), 0);
- }
- #endif
}
if (theCtx->arbFBO->glCheckFramebufferStatus (GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
{
if (myDepthStencilTexture->IsValid())
{
- #ifdef GL_DEPTH_STENCIL_ATTACHMENT
theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, aDepthFormat.PixelFormat() == GL_DEPTH_STENCIL ? GL_DEPTH_STENCIL_ATTACHMENT : GL_DEPTH_ATTACHMENT,
myDepthStencilTexture->GetTarget(), 0, 0);
- #else
- theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
- myDepthStencilTexture->GetTarget(), 0, 0);
- if (aDepthFormat.PixelFormat() == GL_DEPTH_STENCIL)
- {
- theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
- myDepthStencilTexture->GetTarget(), 0, 0);
- }
- #endif
}
if (theCtx->arbFBO->glCheckFramebufferStatus (GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
{
return;
}
-#if !defined(GL_ES_VERSION_2_0)
const OpenGl_GlFunctions* aFuncs = theCtx->Functions();
if (!aFuncs->wglDXLockObjectsNV (myGlD3dDevice, 1, &myGlD3dSurf))
{
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
"D3DHost_FrameBuffer::LockSurface(), lock failed!");
}
-#else
- (void )theCtx;
-#endif
}
// =======================================================================
return;
}
-#if !defined(GL_ES_VERSION_2_0)
const OpenGl_GlFunctions* aFuncs = theCtx->Functions();
aFuncs->wglDXUnlockObjectsNV (myGlD3dDevice, 1, &myGlD3dSurf);
-#endif
}
#include <OpenGl_Caps.hxx>
-#include <OpenGl_GlCore20.hxx>
-
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Caps,Standard_Transient)
// =======================================================================
contextDebug (Standard_False),
contextSyncDebug (Standard_False),
contextNoAccel (Standard_False),
-#if !defined(GL_ES_VERSION_2_0)
contextCompatible (Standard_True),
-#else
- contextCompatible (Standard_False),
-#endif
contextNoExtensions (Standard_False),
contextMajorVersionUpper (-1),
contextMinorVersionUpper (-1),
if (myPointSpriteOrig != aNewState)
{
myPointSpriteOrig = aNewState;
- #if !defined(GL_ES_VERSION_2_0)
core15fwd->glPointParameteri (GL_POINT_SPRITE_COORD_ORIGIN, aNewState);
- #endif
}
}
return;
}
- ::glBindRenderbuffer (GL_RENDERBUFFER, myDefaultFbo->ColorRenderBuffer());
+ myFuncs->glBindRenderbuffer (GL_RENDERBUFFER, myDefaultFbo->ColorRenderBuffer());
[myGContext presentRenderbuffer: GL_RENDERBUFFER];
//::glBindRenderbuffer (GL_RENDERBUFFER, 0);
#else
- glFinish();
+ core11fwd->glFinish();
[myGContext flushBuffer];
#endif
}
#ifndef OpenGl_GlFunctions_HeaderFile
#define OpenGl_GlFunctions_HeaderFile
-#include <OpenGl_GlNative.hxx>
-
#include <Standard_Macro.hxx>
#include <Standard_TypeDef.hxx>
#ifndef OpenGl_GlTypes_HeaderFile
#define OpenGl_GlTypes_HeaderFile
+// required for correct APIENTRY definition
+#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
+ #define WIN32_LEAN_AND_MEAN
+ #include <windows.h>
+#endif
+
+#if defined(__APPLE__)
+ #import <TargetConditionals.h>
+#endif
+
+#ifndef APIENTRY
+ #define APIENTRY
+#endif
+#ifndef APIENTRYP
+ #define APIENTRYP APIENTRY *
+#endif
+#ifndef GLAPI
+ #define GLAPI extern
+#endif
+
+#ifndef GL_APICALL
+ #define GL_APICALL GLAPI
+#endif
+
+// exclude modern definitions and system-provided glext.h, should be defined before gl.h inclusion
+#ifndef GL_GLEXT_LEGACY
+ #define GL_GLEXT_LEGACY
+#endif
+#ifndef GLX_GLXEXT_LEGACY
+ #define GLX_GLXEXT_LEGACY
+#endif
+
#include <OpenGl_khrplatform.h>
typedef khronos_int8_t GLbyte;
myEglDisplay = (Aspect_Display )EGL_NO_DISPLAY;
myEglContext = (Aspect_RenderingContext )EGL_NO_CONTEXT;
#endif
+#if defined(OpenGl_USE_GLES2)
+ myCaps->contextCompatible = false;
+#endif
#if defined(HAVE_XLIB)
if (myDisplayConnection.IsNull())
return Standard_True;
}
-#if !defined(GL_ES_VERSION_2_0)
Standard_Integer aTexIter = 0;
for (NCollection_Vector<Handle(OpenGl_Texture)>::Iterator aTexSrcIter (myTextures); aTexSrcIter.More(); aTexSrcIter.Next(), ++aTexIter)
{
return Standard_False;
}
}
-#endif
return Standard_True;
}
return Standard_True;
}
-#if !defined(GL_ES_VERSION_2_0)
for (size_t aTexIter = 0; aTexIter < myTextureHandles.size(); ++aTexIter)
{
theContext->arbTexBindless->glMakeTextureHandleNonResidentARB (myTextureHandles[aTexIter]);
return Standard_False;
}
}
-#endif
return Standard_True;
}
myTextureHandles.clear();
myTextureHandles.resize (myTextures.Size());
-#if !defined(GL_ES_VERSION_2_0)
Standard_Integer aTexIter = 0;
for (NCollection_Vector<Handle(OpenGl_Texture)>::Iterator aTexSrcIter (myTextures); aTexSrcIter.More(); aTexSrcIter.Next(), ++aTexIter)
{
return Standard_False;
}
}
-#endif
return Standard_True;
}
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
+#if defined(_WIN32)
+ #include <windows.h>
+#endif
+
#include <OpenGl_GlCore12.hxx>
#include <OpenGl_Context.hxx>
EAGLContext* aGLCtx = myGlContext->myGContext;
CAEAGLLayer* anEaglLayer = (CAEAGLLayer* )myUIView.layer;
GLuint aWinRBColor = 0;
- ::glGenRenderbuffers (1, &aWinRBColor);
- ::glBindRenderbuffer (GL_RENDERBUFFER, aWinRBColor);
+ myGlContext->Functions()->glGenRenderbuffers (1, &aWinRBColor);
+ myGlContext->Functions()->glBindRenderbuffer (GL_RENDERBUFFER, aWinRBColor);
[aGLCtx renderbufferStorage: GL_RENDERBUFFER fromDrawable: anEaglLayer];
- ::glGetRenderbufferParameteriv (GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &myWidth);
- ::glGetRenderbufferParameteriv (GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &myHeight);
- ::glBindRenderbuffer (GL_RENDERBUFFER, 0);
+ myGlContext->Functions()->glGetRenderbufferParameteriv (GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &myWidth);
+ myGlContext->Functions()->glGetRenderbufferParameteriv (GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &myHeight);
+ myGlContext->Functions()->glBindRenderbuffer (GL_RENDERBUFFER, 0);
if (!aDefFbo->InitWithRB (myGlContext, Graphic3d_Vec2i (myWidth, myHeight), GL_RGBA8, GL_DEPTH24_STENCIL8, aWinRBColor))
{
myHeightPt = Standard_Integer(aBounds.size.height);
#endif
- ::glDisable (GL_DITHER);
- ::glDisable (GL_SCISSOR_TEST);
- ::glViewport (0, 0, myWidth, myHeight);
-#if !defined(GL_ES_VERSION_2_0)
- ::glDrawBuffer (GL_BACK);
- if (myGlContext->core11ffp != NULL)
+ myGlContext->core11fwd->glDisable (GL_DITHER);
+ myGlContext->core11fwd->glDisable (GL_SCISSOR_TEST);
+ myGlContext->core11fwd->glViewport (0, 0, myWidth, myHeight);
+ if (myGlContext->GraphicsLibrary() != Aspect_GraphicsLibrary_OpenGLES)
{
- ::glMatrixMode (GL_MODELVIEW);
+ myGlContext->core11fwd->glDrawBuffer (GL_BACK);
+ if (myGlContext->core11ffp != NULL)
+ {
+ myGlContext->core11ffp->glMatrixMode (GL_MODELVIEW);
+ }
}
-#endif
}
// =======================================================================