Skip to content

Commit e4c8897

Browse files
Updated handling glPolygonMode function on GLES
1 parent 520227f commit e4c8897

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,9 +426,17 @@ namespace Diligent
426426
{
427427
if( m_RSState.FillMode != FillMode )
428428
{
429-
auto PolygonMode = FillMode == FILL_MODE_WIREFRAME ? GL_LINE : GL_FILL;
430-
glPolygonMode( GL_FRONT_AND_BACK, PolygonMode );
431-
CHECK_GL_ERROR( "Failed to set polygon mode" );
429+
if(glPolygonMode != nullptr)
430+
{
431+
auto PolygonMode = FillMode == FILL_MODE_WIREFRAME ? GL_LINE : GL_FILL;
432+
glPolygonMode( GL_FRONT_AND_BACK, PolygonMode );
433+
CHECK_GL_ERROR( "Failed to set polygon mode" );
434+
}
435+
else
436+
{
437+
if(FillMode != FILL_MODE_SOLID)
438+
LOG_ERROR("This API/device only supports solid fill mode");
439+
}
432440

433441
m_RSState.FillMode = FillMode;
434442
}

Graphics/GraphicsEngineOpenGL/src/GLStubsAndroid.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
#endif
9898

9999
#ifdef LOAD_GL_POLYGON_MODE
100-
DECLARE_GL_FUNCTION( glPolygonMode, PFNGLPOLYGONMODE, GLenum, GLenum)
100+
PFNGLPOLYGONMODE glPolygonMode = nullptr;
101101
#endif
102102

103103
#ifdef LOAD_GL_ENABLEI
@@ -225,7 +225,7 @@ Func = (FuncType)eglGetProcAddress( #Func );\
225225
#endif
226226

227227
#ifdef LOAD_GL_POLYGON_MODE
228-
LOAD_GL_FUNCTION( glPolygonMode, PFNGLPOLYGONMODE)
228+
glPolygonMode = (PFNGLPOLYGONMODE)eglGetProcAddress("glPolygonMode");
229229
#endif
230230

231231
#ifdef LOAD_GL_ENABLEI

Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,9 @@ void RenderDeviceGLImpl::TestTextureFormat( TEXTURE_FORMAT TexFormat )
643643

644644
void RenderDeviceGLImpl :: QueryDeviceCaps()
645645
{
646+
if(glPolygonMode == nullptr)
647+
m_DeviceCaps.bWireframeFillSupported = false;
648+
646649
if(m_DeviceCaps.bWireframeFillSupported)
647650
{
648651
// Test glPolygonMode() function to check if it fails

0 commit comments

Comments
 (0)