]> OCCT Git - occt-copy.git/commitdiff
0026908: Visualization, TKOpenGl - eliminate -Wunused-parameter compiler warnings...
authorisk <isk@opencascade.com>
Tue, 15 Dec 2015 07:58:58 +0000 (10:58 +0300)
committerabv <abv@opencascade.com>
Thu, 17 Dec 2015 15:59:36 +0000 (18:59 +0300)
Support TBO on OpenGL ES 3.2+

13 files changed:
src/OpenGl/OpenGl_ArbTBO.hxx
src/OpenGl/OpenGl_Clipping.cxx
src/OpenGl/OpenGl_Context.cxx
src/OpenGl/OpenGl_GlFunctions.hxx
src/OpenGl/OpenGl_GraphicDriver.cxx
src/OpenGl/OpenGl_LineAttributes.cxx
src/OpenGl/OpenGl_Sampler.cxx
src/OpenGl/OpenGl_ShaderProgram.cxx
src/OpenGl/OpenGl_Structure.cxx
src/OpenGl/OpenGl_TextBuilder.cxx
src/OpenGl/OpenGl_Texture.cxx
src/OpenGl/OpenGl_TextureBufferArb.cxx
src/OpenGl/OpenGl_Workspace.cxx

index 4790d5e2b2d8ed34a727970832ea227e173e3a9c..12b3deb1d9d97f18411d82fbb0c331e7ce013163 100644 (file)
 
 #include <OpenGl_GlFunctions.hxx>
 
-//! TBO is available on OpenGL 3.0+ hardware
+//! TBO is available on OpenGL 3.0+ and OpenGL ES 3.2+ hardware
 struct OpenGl_ArbTBO : protected OpenGl_GlFunctions
 {
-#if !defined(GL_ES_VERSION_2_0)
   using OpenGl_GlFunctions::glTexBuffer;
-#endif
 };
 
 #endif // _OpenGl_ArbTBO_H__
index 37c74228370a609988913209e2b43bf2a1a22509..be8ebffc9c3100fb00d6664941b7883167252891 100755 (executable)
@@ -228,6 +228,8 @@ void OpenGl_Clipping::SetEnabled (const Handle(OpenGl_Context)&      theGlCtx,
   GLenum anID = (GLenum)aProps.ContextID;
   const bool toUseFfp = theGlCtx->core11 != NULL
                      && theGlCtx->caps->ffpEnable;
+#else
+  (void )theGlCtx;
 #endif
   if (theIsEnabled)
   {
index 203de458d14abdd1854ec9ba50310993a336f2aa..2259b8100eb9ca2ed892ef196d1465280f85ba06 100644 (file)
@@ -1142,6 +1142,14 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
 
   arbTexFloat = IsGlGreaterEqual (3, 0)
              && FindProc ("glTexImage3D", myFuncs->glTexImage3D);
+
+  const Standard_Boolean hasTexBuffer32  = IsGlGreaterEqual (3, 2) && FindProc ("glTexBuffer", myFuncs->glTexBuffer);
+  const Standard_Boolean hasExtTexBuffer = CheckExtension ("GL_EXT_texture_buffer") && FindProc ("glTexBufferEXT", myFuncs->glTexBuffer);
+
+  if (hasTexBuffer32 || hasExtTexBuffer)
+  {
+    arbTBO = reinterpret_cast<OpenGl_ArbTBO*> (myFuncs.get());
+  }
 #else
 
   myTexClamp = IsGlGreaterEqual (1, 2) ? GL_CLAMP_TO_EDGE : GL_CLAMP;
index 0ffef344c903fd4a22031daf75db7cfe9e6c19e2..0dee00615471bfed23cc62c9160c3b452abff684 100644 (file)
@@ -66,6 +66,9 @@
   #define GL_TEXTURE_2D_MULTISAMPLE 0x9100
   #define GL_MAX_SAMPLES  0x8D57
 
+  // OpenGL ES 3.2+ or GL_EXT_texture_buffer for OpenGL ES 3.1+
+  #define GL_TEXTURE_BUFFER 0x8C2A
+
   // in core since OpenGL ES 3.0, extension GL_EXT_texture_rg
   #define GL_RED   0x1903
   #define GL_R8    0x8229
   #define GL_RG16F    0x822F
   #define GL_RG32F    0x8230
 
+  #define GL_R32I     0x8235
+  #define GL_RG32I    0x823B
+  #define GL_RGB32I   0x8D83
+  #define GL_RGBA32I  0x8D82
+
   // GL_OES_packed_depth_stencil
   #define GL_DEPTH_STENCIL                  0x84F9
   #define GL_UNSIGNED_INT_24_8              0x84FA
   #define GL_DEBUG_SEVERITY_HIGH        0x9146
   #define GL_DEBUG_SEVERITY_MEDIUM      0x9147
   #define GL_DEBUG_SEVERITY_LOW         0x9148
-
-  // GL_EXT_texture_buffer for OpenGL ES 3.1+
-  #define GL_TEXTURE_BUFFER_ARB             0x8C2A
 #endif
 
 #if defined(__ANDROID__) || defined(__QNX__)
@@ -723,6 +728,11 @@ public: //! @name OpenGL ES 3.1
   typedef void (*glTexStorage2DMultisample_t)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
   glTexStorage2DMultisample_t glTexStorage2DMultisample;
 
+public: //! @name OpenGL ES 3.2
+
+  typedef void (*glTexBuffer_t)(GLenum target, GLenum internalFormat, GLuint buffer);
+  glTexBuffer_t glTexBuffer;
+
 #else // OpenGL ES vs. desktop
 
 public: //! @name OpenGL 1.2
index cb4dc52165c64d2422dab1760b4a111b30866061..f195173112d533c0f2e21f81f1888b38a3fedd6b 100644 (file)
@@ -755,6 +755,7 @@ Standard_Boolean OpenGl_GraphicDriver::ViewExists (const Handle(Aspect_Window)&
     NSView* TheSpecifiedWindowId = THEWindow->HView();
   #endif
 #elif defined(__ANDROID__) || defined(__QNX__)
+  (void )AWindow;
   int TheSpecifiedWindowId = -1;
 #else
   const Handle(Xw_Window) THEWindow = Handle(Xw_Window)::DownCast (AWindow);
index 335a4aed757de0570530c8d59f448a1e8c8a079d..d06ca3b5229349bde6c50d01cb944885bec4c8da 100644 (file)
@@ -545,6 +545,8 @@ void OpenGl_LineAttributes::Init (const Handle(OpenGl_Context)& theGlCtx)
     glPolygonStipple ((const GLubyte* )myInteriors[i < nbi ? i : 0]);
     glEndList();
   }
+#else
+  (void )theGlCtx;
 #endif
 }
 
@@ -567,5 +569,7 @@ void OpenGl_LineAttributes::SetTypeOfHatch (const int theType) const
   }
   else
     glDisable (GL_POLYGON_STIPPLE);
+#else
+  (void )theType;
 #endif
 }
index ea2423bbc1cad199280176db3be680d4b1cb211d..0dc8f9bb797e35cb080f8d41528f133bfc352c5d 100644 (file)
@@ -97,6 +97,9 @@ void OpenGl_Sampler::Bind (OpenGl_Context& theContext,
   {
   #if !defined(GL_ES_VERSION_2_0) || defined(GL_ES_VERSION_3_0)
     theContext.core33->glBindSampler (theUnit, mySamplerID);
+  #else
+    (void )theContext;
+    (void )theUnit;
   #endif
   }
 }
@@ -112,6 +115,9 @@ void OpenGl_Sampler::Unbind (OpenGl_Context& theContext,
   {
   #if !defined(GL_ES_VERSION_2_0) || defined(GL_ES_VERSION_3_0)
     theContext.core33->glBindSampler (theUnit, NO_SAMPLER);
+  #else
+    (void )theContext;
+    (void )theUnit;
   #endif
   }
 }
@@ -128,6 +134,10 @@ void OpenGl_Sampler::SetParameter (OpenGl_Context& theContext,
   {
   #if !defined(GL_ES_VERSION_2_0) || defined(GL_ES_VERSION_3_0)
     theContext.core33->glSamplerParameteri (mySamplerID, theParam, theValue);
+  #else
+    (void )theContext;
+    (void )theParam;
+    (void )theValue;
   #endif
   }
 }
index edf9ad20e8cdda684ca22d03aba1e72f0936c849..4f8ad9b3eced811216eeeef5cb96578df0775597 100755 (executable)
@@ -821,9 +821,11 @@ Standard_Boolean OpenGl_ShaderProgram::SetUniform (const Handle(OpenGl_Context)&
 
 #if !defined(GL_ES_VERSION_2_0)
   theCtx->core32->glUniform2uiv (theLocation, 1, theValue.GetData());
-#endif
-
   return Standard_True;
+#else
+  (void )theValue;
+  return Standard_False;
+#endif
 }
 
 // =======================================================================
@@ -854,9 +856,12 @@ Standard_Boolean OpenGl_ShaderProgram::SetUniform (const Handle(OpenGl_Context)&
 
 #if !defined(GL_ES_VERSION_2_0)
   theCtx->core32->glUniform2uiv (theLocation, theCount, theValue->GetData());
-#endif
-
   return Standard_True;
+#else
+  (void )theCount;
+  (void )theValue;
+  return Standard_False;
+#endif
 }
 
 // =======================================================================
index 31d7a4de418c5b6c3754c1c0eb6b9c4b721226ba..d5e22fc2b9bf18d1ec7be57591e2ca3bb02a0a08 100644 (file)
@@ -87,6 +87,8 @@ public:
     {
       theWorkspace->EnableTexture (aPrevTexture);
     }
+  #else
+    (void )theWorkspace;
   #endif
   }
 
index ea1bbdda0f3f8e3ae35214a1bf78fb7f9b12828b..9505f7443d3b62c4d11a7b6c2bc9dd74acbab2e2 100644 (file)
@@ -57,7 +57,7 @@ void OpenGl_TextBuilder::createGlyphs (const Font_TextFormatter&
   theVertsPerTexture.Clear();
   theTCrdsPerTexture.Clear();
 
-  OpenGl_Font::Tile aTile = {};
+  OpenGl_Font::Tile aTile = {Font_Rect(), Font_Rect(), 0u};
   OpenGl_Vec2       aPen (0.0f, 0.0f);
   Standard_Integer  aRectsNb = 0;
   Standard_Integer  aSymbolsCounter = 0;
index 3a83bd02c351c719b1f5bd2f885a36f13e0198b9..a35e65384f85c84e20f915634bda5c78e1cb8208 100644 (file)
@@ -793,6 +793,9 @@ bool OpenGl_Texture::InitRectangle (const Handle(OpenGl_Context)& theCtx,
   Unbind (theCtx);
   return true;
 #else
+  (void )theSizeX;
+  (void )theSizeY;
+  (void )theFormat;
   return false;
 #endif
 }
index 5a8ca34b63adf42a930656365240b94286fe75f4..964a66bee4f4b72612c52f6eb484638d781c4f14 100644 (file)
@@ -47,7 +47,7 @@ OpenGl_TextureBufferArb::~OpenGl_TextureBufferArb()
 // =======================================================================
 GLenum OpenGl_TextureBufferArb::GetTarget() const
 {
-  return GL_TEXTURE_BUFFER_ARB; // GL_TEXTURE_BUFFER for OpenGL 3.1+
+  return GL_TEXTURE_BUFFER; // GL_TEXTURE_BUFFER for OpenGL 3.1+, OpenGL ES 3.2
 }
 
 // =======================================================================
@@ -98,9 +98,12 @@ bool OpenGl_TextureBufferArb::Init (const Handle(OpenGl_Context)& theGlCtx,
                                     const GLsizei  theElemsNb,
                                     const GLfloat* theData)
 {
-#if !defined(GL_ES_VERSION_2_0)
-  if (theComponentsNb < 1
-   || theComponentsNb > 4)
+  if (theGlCtx->arbTBO == NULL)
+  {
+    return false;
+  }
+  else if (theComponentsNb < 1
+        || theComponentsNb > 4)
   {
     // unsupported format
     return false;
@@ -130,9 +133,6 @@ bool OpenGl_TextureBufferArb::Init (const Handle(OpenGl_Context)& theGlCtx,
   UnbindTexture (theGlCtx);
   Unbind (theGlCtx);
   return true;
-#else
-  return false;
-#endif
 }
 
 // =======================================================================
@@ -144,9 +144,12 @@ bool OpenGl_TextureBufferArb::Init (const Handle(OpenGl_Context)& theGlCtx,
                                     const GLsizei  theElemsNb,
                                     const GLuint*  theData)
 {
-#if !defined(GL_ES_VERSION_2_0)
-  if (theComponentsNb < 1
-   || theComponentsNb > 4)
+  if (theGlCtx->arbTBO == NULL)
+  {
+    return false;
+  }
+  else if (theComponentsNb < 1
+        || theComponentsNb > 4)
   {
     // unsupported format
     return false;
@@ -176,9 +179,6 @@ bool OpenGl_TextureBufferArb::Init (const Handle(OpenGl_Context)& theGlCtx,
   UnbindTexture (theGlCtx);
   Unbind (theGlCtx);
   return true;
-#else
-  return false;
-#endif
 }
 
 // =======================================================================
index 53571c15e4ea9d5a558c73b312ee3c4a9e6a8652..be86c98207f485a48488d26b59f48bde03bf9e79 100644 (file)
@@ -1224,6 +1224,8 @@ Standard_Boolean OpenGl_Workspace::BufferDump (const Handle(OpenGl_FrameBuffer)&
   {
     return Standard_False;
   }
+#else
+  (void )theBufferType;
 #endif
 
   // bind FBO if used