mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 08:00:42 -05:00
2007-05-16 Matthew Allum <mallum@openedhand.com>
* clutter/clutter-backend.c: * clutter/clutter-backend.h: * clutter/clutter-feature.c: * clutter/clutter-feature.h: * clutter/clutter-main.c: * clutter/clutter-main.h: * clutter/clutter-private.h: * clutter/clutter-stage.c: * clutter/cogl/cogl.h: * clutter/cogl/gl/cogl.c: * clutter/cogl/gles/cogl.c: * clutter/glx/clutter-backend-glx.c: * clutter/glx/clutter-backend-glx.h: * clutter/glx/clutter-glx.h: * clutter/glx/clutter-stage-glx.c: * clutter/glx/clutter-stage-glx.h: Rejig the features() foo, moving mostly into backends/cogl.
This commit is contained in:
parent
9d709e3e67
commit
4c01df36e6
2
cogl.h
2
cogl.h
@ -178,6 +178,8 @@ void
|
||||
cogl_alpha_func (COGLenum func,
|
||||
ClutterFixed ref);
|
||||
|
||||
ClutterFeatureFlags
|
||||
cogl_get_features ();
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
68
gl/cogl.c
68
gl/cogl.c
@ -84,11 +84,56 @@ error_string(GLenum errorCode)
|
||||
#define GE(x) (x);
|
||||
#endif
|
||||
|
||||
static gboolean
|
||||
check_gl_extension (const gchar *name,
|
||||
const gchar *ext)
|
||||
{
|
||||
gchar *end;
|
||||
gint name_len, n;
|
||||
|
||||
if (name == NULL || ext == NULL)
|
||||
return FALSE;
|
||||
|
||||
end = (gchar*)(ext + strlen(ext));
|
||||
|
||||
name_len = strlen(name);
|
||||
|
||||
while (ext < end)
|
||||
{
|
||||
n = strcspn(ext, " ");
|
||||
|
||||
if ((name_len == n) && (!strncmp(name, ext, n)))
|
||||
return TRUE;
|
||||
ext += (n + 1);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_gl_version_at_least_12 (void)
|
||||
{
|
||||
/* FIXME: This likely needs to live elsewhere in features or cogl */
|
||||
return
|
||||
(g_ascii_strtod ((const gchar*) glGetString (GL_VERSION), NULL) >= 1.2);
|
||||
|
||||
#if 0
|
||||
/* At least GL 1.2 is needed for CLAMP_TO_EDGE */
|
||||
/* FIXME: move to cogl... */
|
||||
if (!is_gl_version_at_least_12 ())
|
||||
{
|
||||
g_set_error (error, CLUTTER_INIT_ERROR,
|
||||
CLUTTER_INIT_ERROR_BACKEND,
|
||||
"Clutter needs at least version 1.2 of OpenGL");
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
CoglFuncPtr
|
||||
cogl_get_proc_address (const gchar* name)
|
||||
{
|
||||
return NULL;
|
||||
/* FIXME */
|
||||
}
|
||||
|
||||
gboolean
|
||||
@ -527,3 +572,24 @@ cogl_setup_viewport (guint width,
|
||||
1.0f / width) );
|
||||
GE( glTranslatef (0.0f, -1.0 * height, 0.0f) );
|
||||
}
|
||||
|
||||
ClutterFeatureFlags
|
||||
cogl_get_features ()
|
||||
{
|
||||
ClutterFeatureFlags flags = 0;
|
||||
const gchar *gl_extensions;
|
||||
|
||||
flags = CLUTTER_FEATURE_TEXTURE_READ_PIXELS;
|
||||
|
||||
gl_extensions = (const gchar*) glGetString (GL_EXTENSIONS);
|
||||
|
||||
|
||||
if (check_gl_extension ("GL_ARB_texture_rectangle", gl_extensions) ||
|
||||
check_gl_extension ("GL_EXT_texture_rectangle", gl_extensions))
|
||||
{
|
||||
flags |= CLUTTER_FEATURE_TEXTURE_RECTANGLE;
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
@ -515,5 +515,11 @@ cogl_setup_viewport (guint w,
|
||||
CFX_ONE / width));
|
||||
|
||||
GE( glTranslatex (0, -CFX_ONE * height, 0) );
|
||||
|
||||
}
|
||||
|
||||
ClutterFeatureFlags
|
||||
cogl_get_features ()
|
||||
{
|
||||
/* Suck */
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user