0032712: Visualization, OpenGl_Context.hxx - avoid including OpenGL headers
authorkgv <kgv@opencascade.com>
Fri, 3 Dec 2021 16:51:07 +0000 (19:51 +0300)
committersmoskvin <smoskvin@opencascade.com>
Tue, 7 Dec 2021 19:32:15 +0000 (22:32 +0300)
src/OpenGl/OpenGl_Context.cxx
src/OpenGl/OpenGl_Context.hxx
src/OpenGl/OpenGl_IndexBuffer.cxx
src/OpenGl/OpenGl_UniformBuffer.cxx

index da868a0..f5274a6 100644 (file)
@@ -286,7 +286,7 @@ OpenGl_Context::OpenGl_Context (const Handle(OpenGl_Caps)& theCaps)
 #endif
 #endif
 
-  memset (myFuncs.operator->(), 0, sizeof(OpenGl_GlFunctions));
+  memset (myFuncs.get(), 0, sizeof(OpenGl_GlFunctions));
   myShaderManager = new OpenGl_ShaderManager (this);
 }
 
@@ -3142,7 +3142,7 @@ bool OpenGl_Context::SetSampleAlphaToCoverage (bool theToEnable)
 // function : GetBufferSubData
 // purpose  :
 // =======================================================================
-bool OpenGl_Context::GetBufferSubData (GLenum theTarget, GLintptr theOffset, GLsizeiptr theSize, void* theData)
+bool OpenGl_Context::GetBufferSubData (unsigned int theTarget, intptr_t theOffset, intptr_t theSize, void* theData)
 {
   if (!hasGetBufferData)
   {
index 82d1891..ed3418d 100644 (file)
 #include <TColStd_IndexedDataMapOfStringString.hxx>
 #include <TColStd_PackedMapOfInteger.hxx>
 #include <OpenGl_Clipping.hxx>
-#include <OpenGl_GlCore11.hxx>
 
 #include <NCollection_Shared.hxx>
 
+#include <memory>
+
 //! Forward declarations
 #if defined(__APPLE__)
   #import <TargetConditionals.h>
@@ -74,6 +75,8 @@ struct OpenGl_ArbSamplerObject;
 struct OpenGl_ArbTexBindless;
 struct OpenGl_ExtGS;
 
+struct OpenGl_GlCore11Fwd;
+struct OpenGl_GlCore11;
 struct OpenGl_GlCore12;
 struct OpenGl_GlCore13;
 struct OpenGl_GlCore14;
@@ -348,7 +351,7 @@ public:
   Standard_Integer VersionMinor() const { return myGlVerMinor; }
 
   //! Access entire map of loaded OpenGL functions.
-  const OpenGl_GlFunctions* Functions() const { return myFuncs.operator->(); }
+  const OpenGl_GlFunctions* Functions() const { return myFuncs.get(); }
 
   //! Clean up errors stack for this GL context (glGetError() in loop).
   //! @return true if some error has been cleared
@@ -745,7 +748,7 @@ public: //! @name methods to alter or retrieve current state
     return theIndex >= myDrawBuffers.Lower()
         && theIndex <= myDrawBuffers.Upper()
          ? myDrawBuffers.Value (theIndex)
-         : GL_NONE;
+         : 0; // GL_NONE
   }
 
   //! Switch draw buffer, wrapper for ::glDrawBuffer().
@@ -964,12 +967,12 @@ public: //! @name methods to alter or retrieve current state
   //! - OpenGL 1.5+ (desktop) via glGetBufferSubData();
   //! - OpenGL ES 3.0+ via glMapBufferRange();
   //! - WebGL 2.0+ via gl.getBufferSubData().
-  //! @param theTarget [in] target buffer to map
-  //! @param theOffset [in] offset to the beginning of sub-data
-  //! @param theSize   [in] number of bytes to read
-  //! @param theData  [out] destination pointer to fill
+  //! @param[in]  theTarget target buffer to map {GLenum}
+  //! @param[in]  theOffset offset to the beginning of sub-data {GLintptr}
+  //! @param[in]  theSize   number of bytes to read {GLsizeiptr}
+  //! @param[out] theData   destination pointer to fill
   //! @return FALSE if functionality is unavailable
-  Standard_EXPORT bool GetBufferSubData (GLenum theTarget, GLintptr theOffset, GLsizeiptr theSize, void* theData);
+  Standard_EXPORT bool GetBufferSubData (unsigned int theTarget, intptr_t theOffset, intptr_t theSize, void* theData);
 
   //! Return Graphics Driver's vendor.
   const TCollection_AsciiString& Vendor() const { return myVendor; }
@@ -1090,7 +1093,7 @@ private: // context info
   OpenGl_Clipping myClippingState; //!< state of clip planes
 
   void*            myGlLibHandle;          //!< optional handle to GL library
-  NCollection_Handle<OpenGl_GlFunctions>
+  std::unique_ptr<OpenGl_GlFunctions>
                    myFuncs;                //!< mega structure for all GL functions
   Aspect_GraphicsLibrary myGapi;           //!< GAPI name
   Handle(Image_SupportedFormats)
index 0dcf7e7..fb09e40 100644 (file)
@@ -15,6 +15,7 @@
 #include <OpenGl_IndexBuffer.hxx>
 
 #include <OpenGl_Context.hxx>
+#include <OpenGl_GlCore15.hxx>
 #include <Standard_Assert.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(OpenGl_IndexBuffer, OpenGl_Buffer)
index af7fa0b..5e5af55 100644 (file)
@@ -13,7 +13,7 @@
 
 #include <OpenGl_UniformBuffer.hxx>
 
-#include <OpenGl_Context.hxx>
+#include <OpenGl_GlCore15.hxx>
 #include <Standard_Assert.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(OpenGl_UniformBuffer, OpenGl_Buffer)