diff --git a/ChangeLog b/ChangeLog index b9a608205..db507ad27 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-02-05 Matthew Allum + + * clutter/clutter-actor.c: (clutter_actor_get_vertices): + Make sure GL related Matrices are initialised. Fixes #756 + + * clutter/clutter-texture.c: + Fix up code from Norways answer to Jean-Michel Basquiat. + (warning on tile_get_pixbuf) + 2008-02-05 Øyvind Kolås * clutter/clutter-texture.c: removed spurious left over debug printf. diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 71eab171f..60bc6f0f5 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -738,13 +738,38 @@ clutter_actor_get_vertices (ClutterActor *self, ClutterFixed v[4]; ClutterFixed w[4]; ClutterActorPrivate *priv; + ClutterActor *stage; g_return_if_fail (CLUTTER_IS_ACTOR (self)); priv = self->priv; - clutter_actor_transform_vertices (self, verts, w); + /* We essentially have to dupe some code from clutter_redraw() here + * to make sure GL Matrices etc are initialised if we're called and we + * havn't yet rendered anything. + * + * Simply duping code for now in wait for Cogl cleanup that can hopefully + * address this in a nicer way. + */ + stage = clutter_stage_get_default (); + if (CLUTTER_PRIVATE_FLAGS (stage) & CLUTTER_ACTOR_SYNC_MATRICES) + { + ClutterPerspective perspective; + + clutter_stage_get_perspectivex (CLUTTER_STAGE (stage), &perspective); + + cogl_setup_viewport (clutter_actor_get_width (stage), + clutter_actor_get_height (stage), + perspective.fovy, + perspective.aspect, + perspective.z_near, + perspective.z_far); + + CLUTTER_UNSET_PRIVATE_FLAGS (stage, CLUTTER_ACTOR_SYNC_MATRICES); + } + + clutter_actor_transform_vertices (self, verts, w); cogl_get_projection_matrix (mtx_p); cogl_get_viewport (v); diff --git a/clutter/clutter-texture.c b/clutter/clutter-texture.c index f5755f2ad..c20c7fdf9 100644 --- a/clutter/clutter-texture.c +++ b/clutter/clutter-texture.c @@ -1154,7 +1154,9 @@ pixbuf_destroy_notify (guchar *pixels, gpointer data) } static GdkPixbuf * -texture_get_tile_pixbuf (ClutterTexture *texture, COGLuint texture_id, int bpp) +texture_get_tile_pixbuf (ClutterTexture *texture, + COGLuint texture_id, + gint bpp) { ClutterTexturePrivate *priv; guchar *pixels = NULL; @@ -1162,7 +1164,6 @@ texture_get_tile_pixbuf (ClutterTexture *texture, COGLuint texture_id, int bpp) priv = texture->priv; cogl_texture_bind (priv->target_type, texture_id); - cogl_texture_set_alignment (priv->target_type, 4, tex_width); tex_width = priv->width; tex_height = priv->height; @@ -1173,6 +1174,8 @@ texture_get_tile_pixbuf (ClutterTexture *texture, COGLuint texture_id, int bpp) tex_height = clutter_util_next_p2 (priv->height); } + cogl_texture_set_alignment (priv->target_type, 4, tex_width); + if ((pixels = g_malloc (((tex_width * bpp + 3) &~ 3) * tex_height)) == NULL) return NULL;