Add blend equation function for MRTs

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3661 dfc29bdd-3216-0410-991c-e03cc46cb475
master
hybrid 2011-04-26 14:26:26 +00:00
parent 617d5a4e3a
commit 8f2de7d521
2 changed files with 27 additions and 0 deletions

View File

@ -73,6 +73,7 @@ COpenGLExtensionHandler::COpenGLExtensionHandler() :
pGlProvokingVertexARB(0), pGlProvokingVertexEXT(0),
pGlColorMaskIndexedEXT(0), pGlEnableIndexedEXT(0), pGlDisableIndexedEXT(0),
pGlBlendFuncIndexedAMD(0), pGlBlendFunciARB(0),
pGlBlendEquationIndexedAMD(0), pGlBlendEquationiARB(0),
pGlProgramParameteriARB(0), pGlProgramParameteriEXT(0),
pGlGenQueriesARB(0), pGlDeleteQueriesARB(0), pGlIsQueryARB(0),
pGlBeginQueryARB(0), pGlEndQueryARB(0), pGlGetQueryivARB(0),
@ -249,6 +250,8 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
pGlDisableIndexedEXT= (PFNGLDISABLEINDEXEDEXTPROC) wglGetProcAddress("glDisableIndexedEXT");
pGlBlendFuncIndexedAMD= (PFNGLBLENDFUNCINDEXEDAMDPROC) wglGetProcAddress("glBlendFuncIndexedAMD");
pGlBlendFunciARB= (PFNGLBLENDFUNCIPROC) wglGetProcAddress("glBlendFunciARB");
pGlBlendEquationIndexedAMD= (PFNGLBLENDEQUATIONINDEXEDAMDPROC) wglGetProcAddress("glBlendEquationIndexedAMD");
pGlBlendEquationiARB= (PFNGLBLENDEQUATIONIPROC) wglGetProcAddress("glBlendEquationiARB");
pGlProgramParameteriARB= (PFNGLPROGRAMPARAMETERIARBPROC) wglGetProcAddress("glProgramParameteriARB");
pGlProgramParameteriEXT= (PFNGLPROGRAMPARAMETERIEXTPROC) wglGetProcAddress("glProgramParameteriEXT");
@ -571,6 +574,10 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glBlendFuncIndexedAMD"));
pGlBlendFunciARB= (PFNGLBLENDFUNCIPROC)
IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glBlendFunciARB"));
pGlBlendEquationIndexedAMD= (PFNGLBLENDEQUATIONINDEXEDAMDPROC)
IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glBlendEquationIndexedAMD"));
pGlBlendEquationiARB= (PFNGLBLENDEQUATIONIPROC)
IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glBlendEquationiARB"));
pGlProgramParameteriARB = (PFNGLPROGRAMPARAMETERIARBPROC)
IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glProgramParameteriARB"));
pGlProgramParameteriEXT = (PFNGLPROGRAMPARAMETERIEXTPROC)

View File

@ -1034,6 +1034,7 @@ class COpenGLExtensionHandler
void extGlEnableIndexed(GLenum target, GLuint index);
void extGlDisableIndexed(GLenum target, GLuint index);
void extGlBlendFuncIndexed(GLuint buf, GLenum src, GLenum dst);
void extGlBlendEquationIndexed(GLuint buf, GLenum mode);
void extGlProgramParameteri(GLuint program, GLenum pname, GLint value);
// occlusion query
@ -1143,6 +1144,8 @@ class COpenGLExtensionHandler
PFNGLDISABLEINDEXEDEXTPROC pGlDisableIndexedEXT;
PFNGLBLENDFUNCINDEXEDAMDPROC pGlBlendFuncIndexedAMD;
PFNGLBLENDFUNCIPROC pGlBlendFunciARB;
PFNGLBLENDEQUATIONINDEXEDAMDPROC pGlBlendEquationIndexedAMD;
PFNGLBLENDEQUATIONIPROC pGlBlendEquationiARB;
PFNGLPROGRAMPARAMETERIARBPROC pGlProgramParameteriARB;
PFNGLPROGRAMPARAMETERIEXTPROC pGlProgramParameteriEXT;
PFNGLGENQUERIESARBPROC pGlGenQueriesARB;
@ -2174,6 +2177,23 @@ inline void COpenGLExtensionHandler::extGlBlendFuncIndexed(GLuint buf, GLenum sr
}
inline void COpenGLExtensionHandler::extGlBlendEquationIndexed(GLuint buf, GLenum mode)
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (FeatureAvailable[IRR_ARB_draw_buffers_blend] && pGlBlendEquationiARB)
pGlBlendEquationiARB(buf, mode);
if (FeatureAvailable[IRR_AMD_draw_buffers_blend] && pGlBlendEquationIndexedAMD)
pGlBlendEquationIndexedAMD(buf, mode);
#elif defined(GL_ARB_draw_buffers_blend)
glBlendEquationiARB(buf, src, dst);
#elif defined(GL_AMD_draw_buffers_blend)
glBlendEquationIndexedAMD(buf, src, dst);
#else
os::Printer::log("glBlendEquationIndexed not supported", ELL_ERROR);
#endif
}
inline void COpenGLExtensionHandler::extGlProgramParameteri(GLuint program, GLenum pname, GLint value)
{
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)