Hi,

Your demo program works normally for me.

Perhaps it a problem related to others such as VGA driver...



--

 Best Regards,




在2009-12-02,"Aapo Rantalainen" <aapo.rantalai...@gmail.com> 写道:
>Hi, I'm working with actor preloader i.e. main-loop is running and
>another thread loads actors. I'm not even plan to add these on stage,
>just load them.
>
>In this example application I add them to stage, because now it forms
>complete application.
>If in thread I make clutterRectangle, it works.
>If in thread I try to make clutterTexture from image file, I got
>"Failed to create COGL texture".
>
>Is this bug, or how I should make this working?
>
>#include <clutter/clutter.h>
>
>ClutterActor *stage;
>
>void *start_preloader(int parameter) {
>    g_usleep( 1 * G_USEC_PER_SEC );
>    ClutterActor *actor;
>
>    if (parameter==2)
>    {
>        GError* error = NULL;
>        if (!(actor = clutter_texture_new_from_file("image.png", &error))) {
>            fprintf(stderr, "%s\n",  error->message);
>            g_error_free(error);
>        }
>    }
>
>    else
>    {
>        actor =clutter_rectangle_new();
>        clutter_actor_set_size (actor, 400, 80);
>        clutter_actor_set_position (actor, 10, 10);
>        clutter_rectangle_set_border_width(CLUTTER_RECTANGLE(actor),10);
>    }
>
>    clutter_container_add_actor(CLUTTER_CONTAINER(stage), actor);
>    pthread_exit(NULL);
>}
>
>
>int main (int argc, char *argv[]) {
>    ClutterActor  *actor;
>    clutter_init (&argc, &argv);
>
>    stage = clutter_stage_get_default ();
>
>    actor =clutter_rectangle_new();
>    clutter_actor_set_size (actor, 400, 400);
>    clutter_actor_set_position (actor, 40, 40);
>    clutter_rectangle_set_border_width(CLUTTER_RECTANGLE(actor),16);
>
>    clutter_container_add_actor(CLUTTER_CONTAINER(stage), actor);
>    clutter_actor_show_all(stage);
>
>    pthread_t preloader_thread;
>    pthread_create(&preloader_thread, NULL, start_preloader, argc);
>
>    clutter_main();
>    return 0;
>}
>
>
>Usage:
>copy any png image to working directory and rename it to image.png
>compile: gcc `pkg-config --libs --cflags clutter-1.0` main.c
>./a.out
>   Main loop starts, then preloader waits one second. Move mouse over
>stage, so it is refreshed and then second rectangle will be visible.
>
>./a.out BUG
>   Main loop starts, one second later preloader tries to open png file
>and gives error: "Failed to create COGL texture" and actor is NULL.
>
>
>This error message is coming from clutter-texture:1976
>(clutter_texture_set_from_file), but I do not understand why.
>
>-Aapo Rantalainen
>-- 
>To unsubscribe send a mail to clutter+unsubscr...@o-hand.com
>

Reply via email to