Marc Erich Latoschik (marcl++at++TechFak.Uni-Bielefeld.DE)
Wed, 13 Jan 1999 21:31:00 +0100
I have a basic question about subclassing Performer.
I thing it might have something to do with my older problems.
Some of you might use the C++ API and most will
have created their own scenegraph nodes. This, in fact,
works pretty well, like you might expect when C++ing.
So i tried to wrap other classes, e.g. pfPipeWindow and
pfChannel with my own code via subclassing.
I am not trying to overwrite any functions that are
currently handled via the callback system (even if that
would be the natural way ;)), im just wrapping some
user data around and building higher level
functions, e.g have something like a stereo channel that
attaches another channel and behaves like "a view to a scene" to
me. So first i create the subclassed PipeWindow,
after that i call an init function on that window, there
a channel is created and attached to the same pipe
of that window.
after that i call config on that window, guess what...
sometimes it gets configured and opened (what happens in the
config callback) sometimes the application ignores the callback,
and after the app does other stuff, suddenly the output from
my config callback is there, and then i get this misterious
realloc(0) error from Performer, the app stops.
And this happens in singleprocess APPCULLDRAW mode!!!!
okok, might be a little to much, so here are the basic code
fragments...
you might be interested in, otherwise excuse that long mail ;)
-------------------------------snip----------------------------
in the main program i do (Winlist is just a vector of Windows):
......
WinList[i].Shared->pw = new ViewWindow(Pipe[WinList[i].Pipe]);
WinList[i].Shared->pw->Init(WinList[i]);
Scene.push_back(new pfScene);
WinList[i].Shared->pw->SceneAdd(Scene[Scene.size()-1]);
.....
---------------------------------------------------------------
// this is the part in ViewWindow Init where the config is sometimes
// triggered and sometimes notm giving me headaches..
// WindowDef hold data read in from a configuration file
....
WindowDef *win = (WindowDef *)
pfMalloc(sizeof(windef),pfGetSharedArena());
*win = windef;
setUserData(win);
setName(windef.Title);
setWinType(windef.WindowType);
if (!windef.BorderOn) setMode(PFWIN_NOBORDER,1);
// give me the channels(s) according to required mode
MyView = new ViewChannel(windef,getPipe());
addChan(MyView);
if (windef.FullScreenOn)
setFullScreen();
else
setOriginSize(windef.Xll,
windef.Yll,
windef.Width,
windef.Height);
// *****here it comes, sometimes the OpenConfig callback is called
// immediately, the app works fine, but sometimes it is just
ignored?!?
// then inbetween totally different code the output from the callback
// shows up, so it is called out from nowhere, an produces
// a realloc(0). ***BIG SIGH*** any ideas?
setConfigFunc(OpenConfig);
config();
---------------------------------------------------------------
// ViewWindow looks basically like this:
class ViewWindow:public pfPipeWindow
{
public:
ViewWindow(pfPipe *pipe);
virtual ~ViewWindow(){};
virtual void Init(WindowDef &windef);
virtual void SceneAdd(pfScene *scene);
virtual void BaseViewSet(pfMatrix &view);
....
protected:
static void OpenConfig(pfPipeWindow *pw);
ViewChannel *MyView;
....
};
// this is basic Viewchannel:
class ViewChannel: public pfChannel
{
public:
ViewChannel(WindowDef &windef,pfPipe *pipe);
virtual ~ViewChannel();
void Init(WindowDef &windef);
static vector<BO_String> PickedObject;
void SceneSet(pfScene *scene);
....
protected:
// second "eye:
ViewChannel *right;
static void Draw (pfChannel *channel, void *);
static void Cull(pfChannel *, void *);
static int PickHit(pfiPick *pick, void *data);
....
};
--bye Marc
************************************************************************** Marc Erich Latoschik, AG-WBS, Technische Fakultaet, Universitaet Bielefeld Universitaetsstrasse 25, PO 100 131, 33501 Bielefeld Room M4-122 Tel: (0521) 106 2919, Fax: (0521) 106 2962, marcl++at++techfak.uni-bielefeld.de http://www.TechFak.Uni-Bielefeld.DE/techfak/persons/marcl/
This archive was generated by hypermail 2.0b2 on Wed Jan 13 1999 - 12:31:13 PST