Skip to content

Commit

Permalink
[SP] Fix glStencilOpSeparate usage for macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
xycaleth committed Nov 23, 2019
1 parent 2b8b3e6 commit 8f1827a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions code/rd-vanilla/qgl.h
Expand Up @@ -306,6 +306,9 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#define qglStencilFunc glStencilFunc
#define qglStencilMask glStencilMask
#define qglStencilOp glStencilOp
#if defined(__APPLE__)
#define qglStencilOpSeparate glStencilOpSeparate
#endif
#define qglTexCoord1d glTexCoord1d
#define qglTexCoord1dv glTexCoord1dv
#define qglTexCoord1f glTexCoord1f
Expand Down Expand Up @@ -386,7 +389,9 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#define qglVertexPointer glVertexPointer
#define qglViewport glViewport

#if !defined(__APPLE__)
extern PFNGLSTENCILOPSEPARATEPROC qglStencilOpSeparate;
#endif

extern PFNGLACTIVETEXTUREARBPROC qglActiveTextureARB;
extern PFNGLCLIENTACTIVETEXTUREARBPROC qglClientActiveTextureARB;
Expand Down
6 changes: 6 additions & 0 deletions code/rd-vanilla/tr_init.cpp
Expand Up @@ -185,7 +185,9 @@ cvar_t *com_buildScript;
cvar_t *r_environmentMapping;
cvar_t *r_screenshotJpegQuality;

#if !defined(__APPLE__)
PFNGLSTENCILOPSEPARATEPROC qglStencilOpSeparate;
#endif

PFNGLACTIVETEXTUREARBPROC qglActiveTextureARB;
PFNGLCLIENTACTIVETEXTUREARBPROC qglClientActiveTextureARB;
Expand Down Expand Up @@ -671,11 +673,15 @@ static void GLimp_InitExtensions( void )
ri.Cvar_Set( "r_DynamicGlow","0" );
}

#if !defined(__APPLE__)
qglStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC)ri.GL_GetProcAddress("glStencilOpSeparate");
if (qglStencilOpSeparate)
{
glConfig.doStencilShadowsInOneDrawcall = qtrue;
}
#else
glConfig.doStencilShadowsInOneDrawcall = qtrue;
#endif
}

/*
Expand Down

0 comments on commit 8f1827a

Please sign in to comment.