Commit dc41969f authored by hybrid's avatar hybrid

occlusion query extension API necessary for OpenGL extension added. Not usable...

occlusion query extension API necessary for OpenGL extension added. Not usable from Irrlicht API so far.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3262 dfc29bdd-3216-0410-991c-e03cc46cb475
parent f14c5628
...@@ -63,7 +63,10 @@ COpenGLExtensionHandler::COpenGLExtensionHandler() : ...@@ -63,7 +63,10 @@ COpenGLExtensionHandler::COpenGLExtensionHandler() :
pGlProvokingVertexARB(0), pGlProvokingVertexEXT(0), pGlProvokingVertexARB(0), pGlProvokingVertexEXT(0),
pGlColorMaskIndexedEXT(0), pGlEnableIndexedEXT(0), pGlDisableIndexedEXT(0), pGlColorMaskIndexedEXT(0), pGlEnableIndexedEXT(0), pGlDisableIndexedEXT(0),
pGlBlendFuncIndexedAMD(0), pGlBlendFunciARB(0), pGlBlendFuncIndexedAMD(0), pGlBlendFunciARB(0),
pGlProgramParameteriARB(0), pGlProgramParameteriEXT(0) pGlProgramParameteriARB(0), pGlProgramParameteriEXT(0),
pGlGenQueriesARB(0), pGlDeleteQueriesARB(0), pGlIsQueryARB(0),
pGlBeginQueryARB(0), pGlEndQueryARB(0), pGlGetQueryivARB(0),
pGlGetQueryObjectivARB(0), pGlGetQueryObjectuivARB(0)
#endif // _IRR_OPENGL_USE_EXTPOINTER_ #endif // _IRR_OPENGL_USE_EXTPOINTER_
{ {
for (u32 i=0; i<IRR_OpenGL_Feature_Count; ++i) for (u32 i=0; i<IRR_OpenGL_Feature_Count; ++i)
...@@ -234,6 +237,15 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) ...@@ -234,6 +237,15 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
pGlProgramParameteriARB= (PFNGLPROGRAMPARAMETERIARBPROC) wglGetProcAddress("glProgramParameteriARB"); pGlProgramParameteriARB= (PFNGLPROGRAMPARAMETERIARBPROC) wglGetProcAddress("glProgramParameteriARB");
pGlProgramParameteriEXT= (PFNGLPROGRAMPARAMETERIEXTPROC) wglGetProcAddress("glProgramParameteriEXT"); pGlProgramParameteriEXT= (PFNGLPROGRAMPARAMETERIEXTPROC) wglGetProcAddress("glProgramParameteriEXT");
// occlusion query
pGlGenQueriesARB = (PFNGLGENQUERIESARBPROC) wglGetProcAddress("glGenQueriesARB");
pGlDeleteQueriesARB = (PFNGLDELETEQUERIESARBPROC) wglGetProcAddress("glDeleteQueriesARB");
pGlIsQueryARB = (PFNGLISQUERYARBPROC) wglGetProcAddress("glIsQueryARB");
pGlBeginQueryARB = (PFNGLBEGINQUERYARBPROC) wglGetProcAddress("glBeginQueryARB");
pGlEndQueryARB = (PFNGLENDQUERYARBPROC) wglGetProcAddress("glEndQueryARB");
pGlGetQueryivARB = (PFNGLGETQUERYIVARBPROC) wglGetProcAddress("glGetQueryivARB");
pGlGetQueryObjectivARB = (PFNGLGETQUERYOBJECTIVARBPROC) wglGetProcAddress("glGetQueryObjectivARB");
pGlGetQueryObjectuivARB = (PFNGLGETQUERYOBJECTUIVARBPROC) wglGetProcAddress("glGetQueryObjectuivARB");
#elif defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined (_IRR_COMPILE_WITH_SDL_DEVICE_) #elif defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined (_IRR_COMPILE_WITH_SDL_DEVICE_)
#ifdef _IRR_OPENGL_USE_EXTPOINTER_ #ifdef _IRR_OPENGL_USE_EXTPOINTER_
...@@ -527,6 +539,31 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) ...@@ -527,6 +539,31 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
pGlProgramParameteriEXT = (PFNGLPROGRAMPARAMETERIEXTPROC) pGlProgramParameteriEXT = (PFNGLPROGRAMPARAMETERIEXTPROC)
IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glProgramParameteriEXT")); IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glProgramParameteriEXT"));
// occlusion query
pGlGenQueriesARB = (PFNGLGENQUERIESARBPROC)
IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glGenQueriesARB"));
pGlDeleteQueriesARB = (PFNGLDELETEQUERIESARBPROC)
IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glDeleteQueriesARB"));
pGlIsQueryARB = (PFNGLISQUERYARBPROC)
IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glIsQueryARB"));
pGlBeginQueryARB = (PFNGLBEGINQUERYARBPROC)
IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glBeginQueryARB"));
pGlEndQueryARB = (PFNGLENDQUERYARBPROC)
IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glEndQueryARB"));
pGlGetQueryivARB = (PFNGLGETQUERYIVARBPROC)
IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glGetQueryivARB"));
pGlGetQueryObjectivARB = (PFNGLGETQUERYOBJECTIVARBPROC)
IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glGetQueryObjectivARB"));
pGlGetQueryObjectuivARB = (PFNGLGETQUERYOBJECTUIVARBPROC)
IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glGetQueryObjectuivARB"));
#endif // _IRR_OPENGL_USE_EXTPOINTER_ #endif // _IRR_OPENGL_USE_EXTPOINTER_
#endif // _IRR_WINDOWS_API_ #endif // _IRR_WINDOWS_API_
......
...@@ -964,6 +964,15 @@ class COpenGLExtensionHandler ...@@ -964,6 +964,15 @@ class COpenGLExtensionHandler
void extGlBlendFuncIndexed(GLuint buf, GLenum src, GLenum dst); void extGlBlendFuncIndexed(GLuint buf, GLenum src, GLenum dst);
void extGlProgramParameteri(GLuint program, GLenum pname, GLint value); void extGlProgramParameteri(GLuint program, GLenum pname, GLint value);
// occlusion query
void extGlGenQueries(GLsizei n, GLuint *ids);
void extGlDeleteQueries(GLsizei n, const GLuint *ids);
GLboolean extGlIsQuery(GLuint id);
void extGlBeginQuery(GLenum target, GLuint id);
void extGlEndQuery(GLenum target);
void extGlGetQueryiv(GLenum target, GLenum pname, GLint *params);
void extGlGetQueryObjectiv(GLuint id, GLenum pname, GLint *params);
void extGlGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);
protected: protected:
// the global feature array // the global feature array
...@@ -1061,6 +1070,14 @@ class COpenGLExtensionHandler ...@@ -1061,6 +1070,14 @@ class COpenGLExtensionHandler
PFNGLBLENDFUNCIPROC pGlBlendFunciARB; PFNGLBLENDFUNCIPROC pGlBlendFunciARB;
PFNGLPROGRAMPARAMETERIARBPROC pGlProgramParameteriARB; PFNGLPROGRAMPARAMETERIARBPROC pGlProgramParameteriARB;
PFNGLPROGRAMPARAMETERIEXTPROC pGlProgramParameteriEXT; PFNGLPROGRAMPARAMETERIEXTPROC pGlProgramParameteriEXT;
PFNGLGENQUERIESARBPROC pGlGenQueriesARB;
PFNGLDELETEQUERIESARBPROC pGlDeleteQueriesARB;
PFNGLISQUERYARBPROC pGlIsQueryARB;
PFNGLBEGINQUERYARBPROC pGlBeginQueryARB;
PFNGLENDQUERYARBPROC pGlEndQueryARB;
PFNGLGETQUERYIVARBPROC pGlGetQueryivARB;
PFNGLGETQUERYOBJECTIVARBPROC pGlGetQueryObjectivARB;
PFNGLGETQUERYOBJECTUIVARBPROC pGlGetQueryObjectuivARB;
#endif #endif
}; };
...@@ -2082,6 +2099,102 @@ inline void COpenGLExtensionHandler::extGlProgramParameteri(GLuint program, GLen ...@@ -2082,6 +2099,102 @@ inline void COpenGLExtensionHandler::extGlProgramParameteri(GLuint program, GLen
#endif #endif
} }
inline void COpenGLExtensionHandler::extGlGenQueries(GLsizei n, GLuint *ids)
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlGenQueriesARB)
pGlGenQueriesARB(n, ids);
#elif defined(GL_ARB_occlusion_query)
glGenQueriesARB(n, ids);
#else
os::Printer::log("glGenQueriesARB not supported", ELL_ERROR);
#endif
}
inline void COpenGLExtensionHandler::extGlDeleteQueries(GLsizei n, const GLuint *ids)
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlDeleteQueriesARB)
pGlDeleteQueriesARB(n, ids);
#elif defined(GL_ARB_occlusion_query)
glDeleteQueriesARB(n, ids);
#else
os::Printer::log("glDeleteQueriesARB not supported", ELL_ERROR);
#endif
}
inline GLboolean COpenGLExtensionHandler::extGlIsQuery(GLuint id)
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlIsQueryARB)
pGlIsQueryARB(id);
#elif defined(GL_ARB_occlusion_query)
glIsQueryARB(id);
#else
os::Printer::log("glIsQueryARB not supported", ELL_ERROR);
#endif
}
inline void COpenGLExtensionHandler::extGlBeginQuery(GLenum target, GLuint id)
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlBeginQueryARB)
pGlBeginQueryARB(target, id);
#elif defined(GL_ARB_occlusion_query)
glBeginQueryARB(target, id);
#else
os::Printer::log("glBeginQueryARB not supported", ELL_ERROR);
#endif
}
inline void COpenGLExtensionHandler::extGlEndQuery(GLenum target)
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlEndQueryARB)
pGlEndQueryARB(target);
#elif defined(GL_ARB_occlusion_query)
glEndQueryARB(target);
#else
os::Printer::log("glEndQueryARB not supported", ELL_ERROR);
#endif
}
inline void COpenGLExtensionHandler::extGlGetQueryiv(GLenum target, GLenum pname, GLint *params)
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlGetQueryivARB)
pGlGetQueryivARB(target, pname, params);
#elif defined(GL_ARB_occlusion_query)
glGetQueryivARB(target, pname, params);
#else
os::Printer::log("glGetQueryivARB not supported", ELL_ERROR);
#endif
}
inline void COpenGLExtensionHandler::extGlGetQueryObjectiv(GLuint id, GLenum pname, GLint *params)
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlGetQueryObjectivARB)
pGlGetQueryObjectivARB(id, pname, params);
#elif defined(GL_ARB_occlusion_query)
glGetQueryObjectivARB(id, pname, params);
#else
os::Printer::log("glGetQueryObjectivARB not supported", ELL_ERROR);
#endif
}
inline void COpenGLExtensionHandler::extGlGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlGetQueryObjectuivARB)
pGlGetQueryObjectuivARB(id, pname, params);
#elif defined(GL_ARB_occlusion_query)
glGetQueryObjectuivARB(id, pname, params);
#else
os::Printer::log("glGetQueryObjectuivARB not supported", ELL_ERROR);
#endif
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment