2008-02-03 Matthew Allum <mallum@openedhand.com>

* clutter/clutter-actor.c: (clutter_actor_set_rotationx):
        Add notify signal for set_rotate

        * clutter/clutter-texture.c:
        Add basic cleanup code for fbo's

        * tests/test-fbo.c: (main):
        Minor notes.

        * clutter/osx/clutter-stage-osx.c: (clutter_stage_osx_realize):
        Turn on vblanking.
This commit is contained in:
Matthew Allum 2008-02-03 23:25:12 +00:00
parent 9026b8f976
commit 680cd23b43
5 changed files with 73 additions and 8 deletions

View File

@ -1,3 +1,17 @@
2008-02-03 Matthew Allum <mallum@openedhand.com>
* clutter/clutter-actor.c: (clutter_actor_set_rotationx):
Add notify signal for set_rotate
* clutter/clutter-texture.c:
Add basic cleanup code for fbo's
* tests/test-fbo.c: (main):
Minor notes.
* clutter/osx/clutter-stage-osx.c: (clutter_stage_osx_realize):
Turn on vblanking.
2008-02-03 Matthew Allum <mallum@openedhand.com> 2008-02-03 Matthew Allum <mallum@openedhand.com>
* clutter/clutter-shader.c: * clutter/clutter-shader.c:

View File

@ -3256,27 +3256,38 @@ clutter_actor_set_rotationx (ClutterActor *self,
priv = self->priv; priv = self->priv;
g_object_ref (self);
g_object_freeze_notify (G_OBJECT (self));
switch (axis) switch (axis)
{ {
case CLUTTER_X_AXIS: case CLUTTER_X_AXIS:
priv->rxang = angle; priv->rxang = angle;
priv->rxy = CLUTTER_UNITS_FROM_DEVICE (y); priv->rxy = CLUTTER_UNITS_FROM_DEVICE (y);
priv->rxz = CLUTTER_UNITS_FROM_DEVICE (z); priv->rxz = CLUTTER_UNITS_FROM_DEVICE (z);
g_object_notify (G_OBJECT (self), "rotation-angle-x");
g_object_notify (G_OBJECT (self), "rotation-center-x");
break; break;
case CLUTTER_Y_AXIS: case CLUTTER_Y_AXIS:
priv->ryang = angle; priv->ryang = angle;
priv->ryx = CLUTTER_UNITS_FROM_DEVICE (x); priv->ryx = CLUTTER_UNITS_FROM_DEVICE (x);
priv->ryz = CLUTTER_UNITS_FROM_DEVICE (z); priv->ryz = CLUTTER_UNITS_FROM_DEVICE (z);
g_object_notify (G_OBJECT (self), "rotation-angle-y");
g_object_notify (G_OBJECT (self), "rotation-center-y");
break; break;
case CLUTTER_Z_AXIS: case CLUTTER_Z_AXIS:
priv->rzang = angle; priv->rzang = angle;
priv->rzx = CLUTTER_UNITS_FROM_DEVICE (x); priv->rzx = CLUTTER_UNITS_FROM_DEVICE (x);
priv->rzy = CLUTTER_UNITS_FROM_DEVICE (y); priv->rzy = CLUTTER_UNITS_FROM_DEVICE (y);
g_object_notify (G_OBJECT (self), "rotation-angle-z");
g_object_notify (G_OBJECT (self), "rotation-center-z");
break; break;
} }
g_object_thaw_notify (G_OBJECT (self));
g_object_unref (self);
if (CLUTTER_ACTOR_IS_VISIBLE (self)) if (CLUTTER_ACTOR_IS_VISIBLE (self))
clutter_actor_queue_redraw (self); clutter_actor_queue_redraw (self);
} }

View File

@ -124,6 +124,9 @@ enum
static int texture_signals[LAST_SIGNAL] = { 0 }; static int texture_signals[LAST_SIGNAL] = { 0 };
static void
texture_fbo_free_resources (ClutterTexture *texture);
GQuark GQuark
clutter_texture_error_quark (void) clutter_texture_error_quark (void)
{ {
@ -830,6 +833,7 @@ clutter_texture_dispose (GObject *object)
priv = texture->priv; priv = texture->priv;
texture_free_gl_resources (texture); texture_free_gl_resources (texture);
texture_fbo_free_resources (texture);
if (priv->local_pixbuf != NULL) if (priv->local_pixbuf != NULL)
{ {
@ -2075,7 +2079,8 @@ clutter_texture_set_area_from_rgb_data (ClutterTexture *texture,
priv = texture->priv; priv = texture->priv;
if (!texture_prepare_upload (FALSE, texture, data, has_alpha, width, height, rowstride, if (!texture_prepare_upload (FALSE, texture, data, has_alpha,
width, height, rowstride,
bpp, flags, &copy_data, NULL, NULL)) bpp, flags, &copy_data, NULL, NULL))
{ {
return FALSE; return FALSE;
@ -2125,16 +2130,16 @@ clutter_texture_new_from_actor (ClutterActor *actor)
ClutterTexturePrivate *priv; ClutterTexturePrivate *priv;
guint w, h; guint w, h;
/* TODO (before 0.6 release): /* TODO (before 0.6 release):
* *
* - Figure out getting source actor size correctly. * - Figure out getting source actor size correctly.
* - Figure out refing/reparenting source actor.
* - Handle source actor resizing. * - Handle source actor resizing.
* - Handle failure better. * - Handle failure better.
* - Handle cleanup on destruction. * - Handle cleanup on destruction.
* - Beef up test-fbo. * - Beef up test-fbo.
* - Have the source actor as a prop? * - Have the source actor as a prop, realize/unrealize ?
* - Avoid infinite loop in shaders
* - Fix shader rendering order
*/ */
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), NULL); g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), NULL);
@ -2163,9 +2168,9 @@ clutter_texture_new_from_actor (ClutterActor *actor)
if (w == 0 || h == 0) if (w == 0 || h == 0)
return NULL; return NULL;
if (!cogl_texture_can_size (CGL_TEXTURE_RECTANGLE_ARB, if (!cogl_texture_can_size (CGL_TEXTURE_RECTANGLE_ARB,
CGL_RGBA, PIXEL_TYPE, w, h)) CGL_RGBA, PIXEL_TYPE, w, h))
return NULL; return NULL;
texture = g_object_new (CLUTTER_TYPE_TEXTURE, NULL); texture = g_object_new (CLUTTER_TYPE_TEXTURE, NULL);
@ -2201,3 +2206,26 @@ clutter_texture_new_from_actor (ClutterActor *actor)
return CLUTTER_ACTOR(texture); return CLUTTER_ACTOR(texture);
} }
static void
texture_fbo_free_resources (ClutterTexture *texture)
{
ClutterTexturePrivate *priv;
priv = texture->priv;
CLUTTER_MARK();
if (priv->fbo_source != NULL)
{
g_object_unref (priv->fbo_source);
priv->fbo_source = NULL;
}
if (priv->fbo_handle != 0)
{
cogl_offscreen_destroy (priv->fbo_handle);
priv->fbo_handle = 0;
}
}

View File

@ -118,10 +118,16 @@ clutter_stage_osx_state_update (ClutterStageOSX *self,
@implementation ClutterGLView @implementation ClutterGLView
- (id) initWithFrame: (NSRect)aFrame pixelFormat:(NSOpenGLPixelFormat*)aFormat stage:(ClutterActor*)aStage - (id) initWithFrame: (NSRect)aFrame pixelFormat:(NSOpenGLPixelFormat*)aFormat stage:(ClutterActor*)aStage
{ {
int sw = 1;
if ((self = [super initWithFrame:aFrame pixelFormat:aFormat]) != nil) if ((self = [super initWithFrame:aFrame pixelFormat:aFormat]) != nil)
{ {
self->stage = aStage; self->stage = aStage;
} }
/* Enable vblank sync - http://developer.apple.com/qa/qa2007/qa1521.html*/
[[self openGLContext] setValues:&sw forParameter: NSOpenGLCPSwapInterval];
return self; return self;
} }
@ -289,6 +295,7 @@ clutter_stage_osx_realize (ClutterActor *actor)
[self->view setOpenGLContext: context]; [self->view setOpenGLContext: context];
[context setView: self->view]; [context setView: self->view];
CLUTTER_OSX_POOL_RELEASE(); CLUTTER_OSX_POOL_RELEASE();
CLUTTER_SET_PRIVATE_FLAGS(self, CLUTTER_ACTOR_SYNC_MATRICES); CLUTTER_SET_PRIVATE_FLAGS(self, CLUTTER_ACTOR_SYNC_MATRICES);

View File

@ -169,6 +169,11 @@ main (gint argc,
clutter_actor_set_position (fbo, padx*3, pady); clutter_actor_set_position (fbo, padx*3, pady);
clutter_group_add (stage, fbo); clutter_group_add (stage, fbo);
/* TODO:
* Check realize/unrealize
* get_pixbuf()
* set_rgba on fbo texture.
*/
clutter_actor_show_all (stage); clutter_actor_show_all (stage);
clutter_main (); clutter_main ();