Dear Forum,
I've added a line extracting the position of the observer of each view
in celestiacore.cpp in the draw() routine (void CelestiaCore::draw(), see the code below).
Unfortunately, once I split the view horizontally or vertically (so once I ask the position of a non active observer)
I get a Segmentation fault !!!
No idea where the problem can be, except that I've seen that for a new view, the observer
is a raw copie of the active observer.
// Make the new observer a copy of the old one
// TODO: This works, but an assignment operator for Observer
// should be defined.
*o = *(sim->getActiveObserver());
but I do no why it craches.
Any Idea ?
I'm running under linux ubuntu 9.1, using the svn source, version 5006.
Cheers,
yves
.....
else
{
glEnable(GL_SCISSOR_TEST);
for (list<View*>::iterator iter = views.begin();
iter != views.end(); iter++)
{
View* view = *iter;
view->observer->getPosition(); /* <--------------------------- extract observer position */
if (view->type == View::ViewWindow)
{
glScissor((GLint) (view->x * width),
(GLint) (view->y * height),
(GLsizei) (view->width * width),
(GLsizei) (view->height * height));
glViewport((GLint) (view->x * width),
(GLint) (view->y * height),
(GLsizei) (view->width * width),
(GLsizei) (view->height * height));
renderer->resize((int) (view->width * width),
(int) (view->height * height));
sim->render(*renderer, *view->observer);
}
}
.....
view->observer->getPosition() gives Segmentation fault
Re: view->observer->getPosition() gives Segmentation fault
Ok, I can now answer my questions...
Once splitting a view, three views are sored in the list of views.
Two have an observer defined, while the last one doesn't have any (this cause the crash
when calling view->observer->getPosition()).
I haven't understood why the last one is used for.
This has changed since the last version of Celestia.
Cheers,
yves
Once splitting a view, three views are sored in the list of views.
Two have an observer defined, while the last one doesn't have any (this cause the crash
when calling view->observer->getPosition()).
I haven't understood why the last one is used for.
This has changed since the last version of Celestia.
Cheers,
yves