Passthrough Data problem ...

New Message Reply Date view Thread view Subject view Author view

From: jerome serviere (jerome_serviere++at++yahoo.fr)
Date: 08/25/2000 03:16:54


hello all,

I want to pass same datas to 8 channels ...

The datas that I want to pass are shared by shmget and
shmat ...
My channels are defined in a init function and my loop
simulation in another one.

In the sample Passthrough Data of Programmer's Guide
the PfAllocChanData and the pfPassChanData are in the
same function.

       typedef struct
          {
              int val;
          } PassData;

          void cullFunc(pfChannel *chan, void *data);
          void drawFunc(pfChannel *chan, void *data);

          int
          main()
          {
              PassData *pd;

              /* Initialize IRIS Performer */
              pfInit();
              pfConfig();

              /* Create and
                initialize pfChannel 'chan' */
              chan = pfNewChan(pfGetPipe(0));
               :

              /* Setup channel passthrough data */
              pd = (PassData*)pfAllocChanData(chan,
sizeof(PassData));

              /* Bind cull and draw
                callback functions to channel */
              pfChanTravFunc(chan, PFTRAV_CULL,
cullFunc);
              pfChanTravFunc(chan, PFTRAV_DRAW,
drawFunc);

              pd->val = 0;
              pfPassChanData(chan);
              pfFrame();
               :
          }

          void
          cullFunc(pfChannel *chan, void *data)
          {
              PassData *pd = (PassData*)data;
              pd->val++;
              pfCull();
          }

          void
          drawFunc(pfChannel *chan, void *data)
          {
              PassData *pd = (PassData*)data;
              fprintf(stderr, "%ld\n", pd->val);
              pfClearChan(chan);
              pfDraw();
          }

How can I pass the right pd pointer to the loop
simulation for the right channel ???

Is it necessary to allocate 8 times the same structure
??? There isn't any other way ???

Regards.

=====
*==========================================================*

         SERVIERE Jerome Tel : 06.88.22.70.29
                jerome_serviere++at++yahoo.fr ou
         serviere++at++ai.cluny.ensam.fr (pour mail>3Mo)

*==========================================================*

___________________________________________________________
Do You Yahoo!?
Achetez, vendez! À votre prix! Sur http://encheres.yahoo.fr


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Fri Aug 25 2000 - 03:17:01 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.