From e4c889778bf39b393ce071594c39fc2714b90d54 Mon Sep 17 00:00:00 2001 From: Egor Date: Sun, 18 Feb 2018 10:08:40 -0800 Subject: Updated handling glPolygonMode function on GLES --- Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp | 14 +++++++++++--- Graphics/GraphicsEngineOpenGL/src/GLStubsAndroid.cpp | 4 ++-- Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp | 3 +++ 3 files changed, 16 insertions(+), 5 deletions(-) (limited to 'Graphics/GraphicsEngineOpenGL') diff --git a/Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp b/Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp index c05780bc..7f582257 100644 --- a/Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp @@ -426,9 +426,17 @@ namespace Diligent { if( m_RSState.FillMode != FillMode ) { - auto PolygonMode = FillMode == FILL_MODE_WIREFRAME ? GL_LINE : GL_FILL; - glPolygonMode( GL_FRONT_AND_BACK, PolygonMode ); - CHECK_GL_ERROR( "Failed to set polygon mode" ); + if(glPolygonMode != nullptr) + { + auto PolygonMode = FillMode == FILL_MODE_WIREFRAME ? GL_LINE : GL_FILL; + glPolygonMode( GL_FRONT_AND_BACK, PolygonMode ); + CHECK_GL_ERROR( "Failed to set polygon mode" ); + } + else + { + if(FillMode != FILL_MODE_SOLID) + LOG_ERROR("This API/device only supports solid fill mode"); + } m_RSState.FillMode = FillMode; } diff --git a/Graphics/GraphicsEngineOpenGL/src/GLStubsAndroid.cpp b/Graphics/GraphicsEngineOpenGL/src/GLStubsAndroid.cpp index 643aad8a..32d83727 100644 --- a/Graphics/GraphicsEngineOpenGL/src/GLStubsAndroid.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/GLStubsAndroid.cpp @@ -97,7 +97,7 @@ #endif #ifdef LOAD_GL_POLYGON_MODE - DECLARE_GL_FUNCTION( glPolygonMode, PFNGLPOLYGONMODE, GLenum, GLenum) + PFNGLPOLYGONMODE glPolygonMode = nullptr; #endif #ifdef LOAD_GL_ENABLEI @@ -225,7 +225,7 @@ Func = (FuncType)eglGetProcAddress( #Func );\ #endif #ifdef LOAD_GL_POLYGON_MODE - LOAD_GL_FUNCTION( glPolygonMode, PFNGLPOLYGONMODE) + glPolygonMode = (PFNGLPOLYGONMODE)eglGetProcAddress("glPolygonMode"); #endif #ifdef LOAD_GL_ENABLEI diff --git a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp index ffb9794a..4676bb4a 100644 --- a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp @@ -643,6 +643,9 @@ void RenderDeviceGLImpl::TestTextureFormat( TEXTURE_FORMAT TexFormat ) void RenderDeviceGLImpl :: QueryDeviceCaps() { + if(glPolygonMode == nullptr) + m_DeviceCaps.bWireframeFillSupported = false; + if(m_DeviceCaps.bWireframeFillSupported) { // Test glPolygonMode() function to check if it fails -- cgit v1.2.3