memory error when using geomip

Return to C++ coding using Panda3D

memory error when using geomip

Postby AngrySCV » Mon Jul 16, 2012 12:11 pm

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:
Code: Select all
#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:
Code: Select all
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.
AngrySCV
 
Posts: 8
Joined: Mon May 28, 2012 10:57 pm

Postby tah » Mon Jul 16, 2012 8:58 pm

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
tah
 
Posts: 173
Joined: Fri Oct 29, 2010 3:25 pm
Location: Torrance, CA.

Postby AngrySCV » Tue Jul 17, 2012 2:18 pm

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
Code: Select all
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
Code: Select all
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.
AngrySCV
 
Posts: 8
Joined: Mon May 28, 2012 10:57 pm

Postby rdb » Wed Jul 18, 2012 1:48 am

What is the size (width, height) of part_0.png?
rdb
 
Posts: 8637
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby AngrySCV » Wed Jul 18, 2012 9:14 am

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.
AngrySCV
 
Posts: 8
Joined: Mon May 28, 2012 10:57 pm

Postby dri » Fri Jul 20, 2012 10:14 pm

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

Code: Select all
$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
dri
 
Posts: 48
Joined: Sat May 12, 2012 2:40 am

Postby AngrySCV » Sat Jul 21, 2012 8:25 am

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.
AngrySCV
 
Posts: 8
Joined: Mon May 28, 2012 10:57 pm


Return to C++ coding using Panda3D

Who is online

Users browsing this forum: No registered users and 0 guests