Use the GL_ARB_multitexture extension on GL 1.2

Cogl requires multi-texturing support. This is only available as an
extension in GL 1.2 so we should check for it before accepting the
driver.

http://bugzilla.openedhand.com/show_bug.cgi?id=1875
This commit is contained in:
Neil Roberts 2009-11-11 16:42:53 +00:00
parent 2e99b276a4
commit 62a37d8e53

View File

@ -153,6 +153,7 @@ gboolean
_cogl_check_driver_valid (GError **error) _cogl_check_driver_valid (GError **error)
{ {
int major, minor; int major, minor;
const gchar *gl_extensions;
if (!_cogl_get_gl_version (&major, &minor)) if (!_cogl_get_gl_version (&major, &minor))
{ {
@ -163,6 +164,24 @@ _cogl_check_driver_valid (GError **error)
return FALSE; return FALSE;
} }
/* GL 1.3 supports all of the required functionality in core */
if (COGL_CHECK_GL_VERSION (major, minor, 1, 3))
return TRUE;
gl_extensions = (const gchar*) glGetString (GL_EXTENSIONS);
/* OpenGL 1.2 is only supported if we have the multitexturing
extension */
if (!cogl_check_extension ("GL_ARB_multitexture", gl_extensions))
{
g_set_error (error,
COGL_DRIVER_ERROR,
COGL_DRIVER_ERROR_INVALID_VERSION,
"The OpenGL driver is missing "
"the GL_ARB_multitexture extension");
return FALSE;
}
/* OpenGL 1.2 is required */ /* OpenGL 1.2 is required */
if (!COGL_CHECK_GL_VERSION (major, minor, 1, 2)) if (!COGL_CHECK_GL_VERSION (major, minor, 1, 2))
{ {
@ -484,13 +503,6 @@ _cogl_features_init (void)
ctx->drv.pf_glDrawRangeElements = ctx->drv.pf_glDrawRangeElements =
(COGL_PFNGLDRAWRANGEELEMENTSPROC) (COGL_PFNGLDRAWRANGEELEMENTSPROC)
cogl_get_proc_address ("glDrawRangeElements"); cogl_get_proc_address ("glDrawRangeElements");
ctx->drv.pf_glActiveTexture =
(COGL_PFNGLACTIVETEXTUREPROC)
cogl_get_proc_address ("glActiveTexture");
ctx->drv.pf_glClientActiveTexture =
(COGL_PFNGLCLIENTACTIVETEXTUREPROC)
cogl_get_proc_address ("glClientActiveTexture");
ctx->drv.pf_glBlendEquation = ctx->drv.pf_glBlendEquation =
(COGL_PFNGLBLENDEQUATIONPROC) (COGL_PFNGLBLENDEQUATIONPROC)
cogl_get_proc_address ("glBlendEquation"); cogl_get_proc_address ("glBlendEquation");
@ -498,6 +510,26 @@ _cogl_features_init (void)
(COGL_PFNGLBLENDCOLORPROC) (COGL_PFNGLBLENDCOLORPROC)
cogl_get_proc_address ("glBlendColor"); cogl_get_proc_address ("glBlendColor");
/* Available in 1.3 or in the GL_ARB_multitexture extension */
if (COGL_CHECK_GL_VERSION (gl_major, gl_minor, 1, 3))
{
ctx->drv.pf_glActiveTexture =
(COGL_PFNGLACTIVETEXTUREPROC)
cogl_get_proc_address ("glActiveTexture");
ctx->drv.pf_glClientActiveTexture =
(COGL_PFNGLCLIENTACTIVETEXTUREPROC)
cogl_get_proc_address ("glClientActiveTexture");
}
else if (cogl_check_extension ("GL_ARB_multitexture", gl_extensions))
{
ctx->drv.pf_glActiveTexture =
(COGL_PFNGLACTIVETEXTUREPROC)
cogl_get_proc_address ("glActiveTextureARB");
ctx->drv.pf_glClientActiveTexture =
(COGL_PFNGLCLIENTACTIVETEXTUREPROC)
cogl_get_proc_address ("glClientActiveTextureARB");
}
/* Available in 1.4 */ /* Available in 1.4 */
if (COGL_CHECK_GL_VERSION (gl_major, gl_minor, 1, 4)) if (COGL_CHECK_GL_VERSION (gl_major, gl_minor, 1, 4))
ctx->drv.pf_glBlendFuncSeparate = ctx->drv.pf_glBlendFuncSeparate =