Fix compilation with older libGL

the mutlitexture and texture_rectangle extensions have recently
been incorporated into the GL core; fixes needed to work with
libGL that proceeds that:

GL_TEXTURE_RECTANGLE_ARB - use _ARB name
glActiveTextureARB() - use get_proc_address

https://bugzilla.gnome.org/show_bug.cgi?id=602870
This commit is contained in:
Owen W. Taylor 2009-11-24 15:53:32 -05:00
parent 14987f2b21
commit bdb3be7084

View File

@ -32,6 +32,7 @@
#endif #endif
#if !CLUTTER_CHECK_VERSION(1,1,3) #if !CLUTTER_CHECK_VERSION(1,1,3)
static PFNGLACTIVETEXTUREPROC activeTexture;
static PFNGLGENFRAMEBUFFERSPROC genFramebuffers; static PFNGLGENFRAMEBUFFERSPROC genFramebuffers;
static PFNGLDELETEFRAMEBUFFERSPROC deleteFramebuffers; static PFNGLDELETEFRAMEBUFFERSPROC deleteFramebuffers;
static PFNGLBINDFRAMEBUFFERPROC bindFramebuffer; static PFNGLBINDFRAMEBUFFERPROC bindFramebuffer;
@ -488,6 +489,7 @@ initialize_gl_functions (void)
{ {
initialized = TRUE; initialized = TRUE;
activeTexture = (PFNGLACTIVETEXTUREPROC) cogl_get_proc_address ("glActiveTextureARB");
genFramebuffers = (PFNGLGENFRAMEBUFFERSPROC) cogl_get_proc_address ("glGenFramebuffersEXT"); genFramebuffers = (PFNGLGENFRAMEBUFFERSPROC) cogl_get_proc_address ("glGenFramebuffersEXT");
deleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC) cogl_get_proc_address ("glDeleteFramebuffersEXT"); deleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC) cogl_get_proc_address ("glDeleteFramebuffersEXT");
bindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC) cogl_get_proc_address ("glBindFramebufferEXT"); bindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC) cogl_get_proc_address ("glBindFramebufferEXT");
@ -550,9 +552,9 @@ texture_tower_revalidate_fbo (MutterTextureTower *tower,
cogl_texture_get_gl_texture (source_texture, &source_gl_tex, &source_gl_target); cogl_texture_get_gl_texture (source_texture, &source_gl_tex, &source_gl_target);
glActiveTextureARB (GL_TEXTURE0_ARB); (*activeTexture) (GL_TEXTURE0_ARB);
if (source_gl_target == GL_TEXTURE_2D) if (source_gl_target == GL_TEXTURE_2D)
glDisable (GL_TEXTURE_RECTANGLE); glDisable (GL_TEXTURE_RECTANGLE_ARB);
else else
glDisable (GL_TEXTURE_2D); glDisable (GL_TEXTURE_2D);
glEnable (source_gl_target); glEnable (source_gl_target);
@ -568,12 +570,12 @@ texture_tower_revalidate_fbo (MutterTextureTower *tower,
* than three are used by Mutter and all GL implementations we care * than three are used by Mutter and all GL implementations we care
* about will support at least 3. * about will support at least 3.
*/ */
glActiveTextureARB (GL_TEXTURE1_ARB); (*activeTexture) (GL_TEXTURE1_ARB);
glDisable (GL_TEXTURE_2D); glDisable (GL_TEXTURE_2D);
glDisable (GL_TEXTURE_RECTANGLE); glDisable (GL_TEXTURE_RECTANGLE_ARB);
glActiveTextureARB (GL_TEXTURE2_ARB); (*activeTexture) (GL_TEXTURE2_ARB);
glDisable (GL_TEXTURE_2D); glDisable (GL_TEXTURE_2D);
glDisable (GL_TEXTURE_RECTANGLE); glDisable (GL_TEXTURE_RECTANGLE_ARB);
glViewport (0, 0, dest_texture_width, dest_texture_height); glViewport (0, 0, dest_texture_width, dest_texture_height);