> I believe the following should suffice to make it work:
> 
> ImageForegroundPtr ifp;
> 
> beginEditCP(ifp, ImageForeground::ImagesFieldMask);
> endEditCP(ifp, ImageForeground::ImagesFieldMask);
> 
> If you call the add method, the Foreground knows that the image has changed 
> and thus transmitts the data over the network. And the old images remain 
> visible, because the the ImageForeground actually supports to display more 
> than one image at different positions on the screen, so you keep adding new 
> ones by repeatedly calling the add method.



Hi.
I tried to add the image in two ways... But it doesn't work at all!

                beginEditCP(imf);
                        imf->addImage( image, position );
                endEditCP(imf);

In this first case the image is not updated when I modify it...

                beginEditCP(imf, ImageForeground::ImagesFieldMask);
                        imf->addImage( image, position  );
                endEditCP(imf, ImageForeground::ImagesFieldMask);

In this case the image is not visible!


Here there is all the code... I hope somebody sees an error! Anyway, thanks for 
your help.

addForeground( ViewportPtr viewportRight, ViewportPtr viewportLeft, string 
label )
{
        //addForeground is called continuously. We use this counter to add 
image and foreground only the first time
        static int first = 0;   

        // Create the new image
        Text2d *oText = new Text2d( makeCoredNode<Group>() );
        oText->createLabel( label, 26 );
        oText->setLabelPosition(Pnt3f(0.0f,0.0f,0.0f),0);
        image = oText->getImage();

        if (first<1)
        {
                beginEditCP(imf, ImageForeground::ImagesFieldMask);
                        imf->addImage( image, position  );
                endEditCP(imf, ImageForeground::ImagesFieldMask);

                beginEditCP( viewportRight);
                        viewportRight->getForegrounds().push_back(imf); 
                endEditCP( viewportRight);

                beginEditCP( viewportLeft);
                        viewportLeft->getForegrounds().push_back(imf); 
                endEditCP( viewportLeft);

                first++;
        }

        delete oText;
}



Cheers, 
Antonio


___________________________________________________________________
Dimagrire in 30 giorni con New Giorno & Notte! Garanzia 100% Soddisfatti o 
Rimborsati! 
http://click.libero.it/diete



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to