1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00

0026908: Visualization, TKOpenGl - eliminate -Wunused-parameter compiler warnings for Android target

Support TBO on OpenGL ES 3.2+
This commit is contained in:
isk 2015-12-15 10:58:58 +03:00 committed by abv
parent e9312c0fc2
commit 20aeeb7be3
13 changed files with 69 additions and 24 deletions

View File

@ -18,12 +18,10 @@
#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__

View File

@ -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)
{

View 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;

View 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
@ -103,6 +106,11 @@
#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
@ -147,9 +155,6 @@
#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

View 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);

View 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
}

View 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
}
}

View File

@ -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
}
// =======================================================================

View File

@ -87,6 +87,8 @@ public:
{
theWorkspace->EnableTexture (aPrevTexture);
}
#else
(void )theWorkspace;
#endif
}

View 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;

View 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
}

View 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
}
// =======================================================================

View 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