I’m trying to get a modified version of the second tutorial in the manual to work (in c++ of course) using the following code:
#include "pandaFramework.h"
#include "pandaSystem.h"
#include "geoMipTerrain.h"
#include <iostream>
PandaFramework framework;
int main(int argc, char *argv[]) {
//open a new window framework
framework.open_framework(argc, argv);
//set the window title to My Panda3D Window
framework.set_window_title("terrain tester");
//open the window
WindowFramework *window = framework.open_window();
//here is room for your own code
GeoMipTerrain *terr= new GeoMipTerrain("");
std::cerr<<"loading ";
terr->set_heightfield((string)"part_0.png");
std::cerr<<"done \n";
NodePath terrRoot = terr->get_root();
std::cerr<<"1\n";
terr->generate();
std::cerr<<"2\n";
terrRoot.reparent_to( window->get_render() );
std::cerr<<"3\n";
terrRoot.set_scale( 5,5,5);
std::cerr<<"4\n";
terrRoot.set_pos( 0,0,-10);
std::cerr<<"5\n";
//do the main loop, equal to run() in python
framework.main_loop();
//close the window framework
framework.close_framework();
return (0);
}
when I compile will g++ on fedora17/linux and run it I get the following output:
Known pipe types:
glxGraphicsPipe
(all display modules loaded.)
:display:glxdisplay(warning): No suitable FBConfig contexts available; using XVisual only.
depth_bits=24 color_bits=24 alpha_bits=8 stencil_bits=8 back_buffers=1 force_hardware=1
loading done
1
base: dtool/src/dtoolbase/typeHandle.cxx:99: void TypeHandle::dec_memory_usage(TypeHandle::MemoryClass, int): Assertion `rnode->_memory_usage[memory_class] >= 0' failed.
I’ve tried moving the get_root after the generate. That does not change the output at all. If the geoMip code is replaced with the tutorials model loader everything works as expected.
Any help would be appreciated.
tah
July 17, 2012, 1:58am
#2
Hi
I was able to compile and run your code with my own png file using Visual C++. Maybe you are not seeing the Config.prc located in your Panda’s etc folder
As I change the options in the /etc/Config.prc file the window seems responsive before it dies. Specificity the starting window position changes as expected. I’ve lost the
base: dtool/src/dtoolbase/typeHandle.cxx:99: void TypeHandle::dec_memory_usage(TypeHandle::MemoryClass, int): Assertion `rnode->_memory_usage[memory_class] >= 0' failed.
error. It now reads
Known pipe types:
glxGraphicsPipe
(all display modules loaded.)
:display:glxdisplay(warning): No suitable FBConfig contexts available; using XVisual only.
depth_bits=24 color_bits=24 alpha_bits=8 stencil_bits=8 back_buffers=1 force_hardware=1
loading done
1
make: *** [run] Aborted (core dumped)
All I’ve done is change windowOrigin in the /etc/Config.prc and reboot a couple of times.
rdb
July 18, 2012, 6:48am
#4
What is the size (width, height) of part_0.png?
257 by 257 pixels, I’ve gotten it to compile and run on another computer running ubuntu. I’m now convinced it’s an error with how my fedora’s panda3d is compiled. How would you go about chasing down this kind of error?
EDIT: error line that vanished is back again.
dri
July 21, 2012, 3:14am
#6
I haven’t much to offer but your code runs just fine on my linux box. Here’s my setup:
Ubuntu 10.10
g++ (Ubuntu/Linaro 4.4.4-14ubuntu5.1) 4.4.5
panda3d1.7_1.7.2~maverick_i386.deb
$g++ -c test.cpp -o test.o -fPIC -O2 -I/usr/include/python2.6/ -I/usr/include/panda3d/
$g++ test.o -o test -fPIC -L/usr/lib/panda3d/ -lp3framework -lpanda -lpandafx -lpandaexpress -lp3dtoolconfig -lp3dtool -lp3pystub -lp3direct
$./test
Known pipe types:
glxGraphicsPipe
(all display modules loaded.)
loading done
1
2
3
4
5
After much frustration and trial and error I’ve switched from the cvs head to panda 1.8. The problem vanished after switching.
Before giving up on the cvs I traced to crash back to ~pvector() with the signal being thrown from a non panda3d library.