Re: PB with the C++ API of performer

New Message Reply Date view Thread view Subject view Author view

From: Tanner Lovelace (lovelace++at++cthulhu.engr.sgi.com)
Date: 08/11/2000 10:28:05


GAUVIN Yves wrote:

> I have some problems concerning the node types. I have written a base
> loader which works with a XML file. I don't know which type will be the
> node until I read the XML file, so I say that it's a pfNode. I had no
> problem in C, but now it doesn't compile.
> The error messages are the following:
>
> [gauvin++at++d2r2 sofi]$ make
> making OpenGL DSO version of sofi
> make[1]: Entering directory `/home/gauvin/sofi/OPT.I386.OPENGL'
> /usr/bin/g++ -O -O -Wall -MD -DI386 -DLinux -I/usr/include
> -I.. -I/home/gauvin/sofi/source -I/usr/include/CC -I/usr/include/g++-3
> -I/home/gauvin/VRPN/vrpn -I/usr/lib/glib/include
> -I/usr/lib/gnome-libs/include -I/home/gauvin/sofi/headers
> -I/usr/include -I/usr/include/g++ -c
> /home/gauvin/sofi/source/SOFI_loadxml.cpp
> /home/gauvin/sofi/source/SOFI_loadxml.cpp: In function `void
> SO_disable_shadow(pfNode *)':
> /home/gauvin/sofi/source/SOFI_loadxml.cpp:300: type `const pfGroup' is
> not a base type for type `pfNode'
[...]

So you are passing in a pfNode* to a function, correct?
You need to check to make sure it actually is a pfGroup/pfDCS/etc...
before you call functions for that routine. Try something like this:

SO_disable_shadow(pfNode *n)
{
  if (pfIsOfType(n, pfGroup::getClassType())) {
    pfGroup *group = (pfGroup *)n;

    // pfGroup functions here
  } else if (pfIsOfType(n, pfDCS::getClassType())) {
    pfDCS *dcs = (pfDCS *)n;

    // pfDCS functions here

  }
  // etc...
}

> I try the cast but it makes other errors and my special includes are :
> #include <Performer/pf/pfNode.h>
> #include <Performer/pf/pfLOD.h>
> #include <Performer/pf/pfDCS.h>
> #include <Performer/pf/pfScene.h>

Don't forget to include <Performer/pf/pfGroup.h> if you're going
to use pfGroups.
 
Tanner Lovelace


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Fri Aug 11 2000 - 10:28:12 PDT

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