[GRASS-dev] Re: [GRASS-user] [bug #3041] nviz max resolution ppm
image dump
Bob Covill
bcovill at tekmap.ns.ca
Tue Aug 29 07:57:37 EDT 2006
Hi Hamish,
I suspect there are a few bugs with some of the math in this. The best
place to start looking is Nstart_zoom_cmd in do_zoom.c (nviz/src). The
off-screen stuff was generating the MALLOC error for me this morning.
After the off-screen buffer was created the maxx and maxy returned were
incorrect which resulted in negative numbers being passed to malloc
which of course produced an error. I disabled the off-screen stuff and
it worked fine.
To debug this I would first start by disabling the off-screen stuff in
Nstart_zoom and draw the images directly. Also, check the dimensions
that are being calculated and passed to GS_write_zoom.
Hope this helps.
--
Bob
On Tue, 2006-08-29 at 18:06 +1200, Hamish wrote:
> William Hargrove wrote:
> > >>My nviz dies with a segfault when I try to dump an image as maximum
> > >>resolution ppm.
> > >>
> > >>I have this same problem with grass 6.1 under FC 5, and under grass
> > >>5.4 under FC 4.
> ..
> > >>I can dump the other formats just fine.
> > >>
> > >>The map products look great on the screen, but aren't much use if I
> > >>can't get them into a high-res image file.
> > >>
> > >>Does anyone have any advice on this problem?
>
> Hamish wrote:
> > >what's the date on the 6.1? 6.1.0 or 6.1-cvs? This was an old known
> > >problem on 64bit &/or big endian (Mac G5), I had thought that it was
> > >fixed by Glynn & crew some months ago.
>
> I guess it is this bug after all:
>
> > > http://intevation.de/rt/webrt?serial_num=3041
>
>
> William Hargrove wrote:
> > This is 6.1.0 built from source, running under 64-bit FC 5.
> >
> > Here is what happens when I try to dump a max-res ppm:
> >
> > recalculating normals...
> > recalculating normals...
> > Diagnostic: invalid command name "Nviz_animation_save" -- Save
> > procedure for panel animation may not be defined
> > Diagnostic: invalid command name "Nviz_kanimator_save" -- Save
> > procedure for panel kanimator may not be defined
> > Diagnostic: invalid command name "Nviz_query_save" -- Save procedure
> > for panel query may not be defined
> > Diagnostic: invalid command name "Nviz_sdiff_save" -- Save procedure
> > for panel sdiff may not be defined
> > Diagnostic: invalid command name "Nviz_label_save" -- Save procedure
> > for panel label may not be defined
> > Diagnostic: invalid command name "Nviz_scale_save" -- Save procedure
> > for panel scale may not be defined
> > Diagnostic: invalid command name "Nviz_pos_save" -- Save procedure
> > for panel pos may not be defined
> > Diagnostic: invalid command name "Nviz_resize_save" -- Save procedure
> >
> > for panel resize may not be defined
> > Diagnostic: invalid command name "Nviz_pick_save" -- Save procedure
> > for panel pick may not be defined
> > Diagnostic: invalid command name "Nviz_highlight_save" -- Save
> > procedure for panel highlight may not be defined
> > Creating PBuffer Using GLX 1.3
> > Final Assembled Image will be 1 x 1
> > Writing Tile 1 of 1
> > Assembling Tiles
> > GLX -- destroy pbuffer
> > ./donviz: line 2: 10088 Segmentation fault nviz
> > elevation=elev48.new color=neon2.25
> > vector=states100,neondomains_states
> >
> > Any ideas?
>
>
> I get a segfault too: (32bit P4, 2gig RAM, Debian/stable)
>
> Speafish with nviz window made to be large:
>
> G63> nviz elevation.10m
> Loading Data
> Update elev null mask
> Loading Data
> translating colors from fp
> recalculating normals...
> r200_makeX86Normal3fv/197 CVAL 0 OFFSET 14 VAL 8260df0
> r200_makeX86Normal3fv/198 CVAL 4 OFFSET 20 VAL 8260df4
> r200_makeX86Normal3fv/199 CVAL 8 OFFSET 25 VAL 8260df8
> r200_makeX86Normal3fv done
> % recalculating normals...
> Creating PBuffer Using GLX 1.3
> Create PixMap Using GLX 1.1
> Final Assembled Image will be 1935 x 2048
> Writing Tile 1 of 9
> Writing Tile 2 of 9
> Writing Tile 3 of 9
> MALLOC Failed
> Segmentation fault
>
> (hard to replicate)
>
> The "MALLOC Failed" message comes from lib/ogsf/gsd_prim.c
>
> /************************************************************************/
> int gsd_writeView(unsigned char **pixbuf, unsigned int xsize,
> unsigned int ysize)
> {
>
> /* Malloc Buffer for image */
> *pixbuf = malloc(xsize * ysize * 4);
>
>
> if (!*pixbuf) {
> fprintf(stderr, "MALLOC Failed\n");
> return (0);
> }
>
> /* Read image buffer */
> glReadBuffer(GL_FRONT);
>
> /* Read Pixels into Buffer */
> glReadPixels(0, 0, xsize, ysize, GL_RGBA, GL_UNSIGNED_BYTE, *pixbuf);
> return (1);
> }
>
> /************************************************************************/
>
>
>
>
>
>
> with window left at starting size: [note larger "Final Assembled Size"]
>
> G63> nviz elevation.10m
> Loading Data
> Update elev null mask
> Loading Data
> translating colors from fp
> recalculating normals...
> r200_makeX86Normal3fv/197 CVAL 0 OFFSET 14 VAL 82613f8
> r200_makeX86Normal3fv/198 CVAL 4 OFFSET 20 VAL 82613fc
> r200_makeX86Normal3fv/199 CVAL 8 OFFSET 25 VAL 8261400
> r200_makeX86Normal3fv done
> % Creating PBuffer Using GLX 1.3
> Create PixMap Using GLX 1.1
> Final Assembled Image will be 2048 x 2048
> Writing Tile 1 of 9
> Writing Tile 2 of 9
> Writing Tile 3 of 9
> Writing Tile 4 of 9
> Writing Tile 5 of 9
> Writing Tile 6 of 9
> Writing Tile 7 of 9
> Writing Tile 8 of 9
> Writing Tile 9 of 9
> Assembling Tiles
> pnmcat: Zero byte allocation
> pnmcat failed to create assembled image
> Check that pnmcat is installed and path is set
> pnmcat: Zero byte allocation
> pnmcat failed to create assembled image
> Check that pnmcat is installed and path is set
> pnmcat: Zero byte allocation
> pnmcat failed to create assembled image
> Check that pnmcat is installed and path is set
> pnmcat: EOF / read error reading magic number
> pnmcat failed to create assembled images
> Check that pnmcat is installed and path is set
> Destroy Pixmap and GLXPixmap
>
> no segfault, NVIZ keeps running, these files are left behind:
> (easy to replicate)
>
>
> 0 Aug 29 17:24 spearNVhi2.ppm
> 3145745 Aug 29 17:24 spearNVhi2_1_1.ppm
> 3145745 Aug 29 17:24 spearNVhi2_1_2.ppm
> 14 Aug 29 17:24 spearNVhi2_1_3.ppm
> 3145745 Aug 29 17:24 spearNVhi2_2_1.ppm
> 3145745 Aug 29 17:24 spearNVhi2_2_2.ppm
> 14 Aug 29 17:24 spearNVhi2_2_3.ppm
> 14 Aug 29 17:24 spearNVhi2_3_1.ppm
> 14 Aug 29 17:24 spearNVhi2_3_2.ppm
> 11 Aug 29 17:24 spearNVhi2_3_3.ppm
> 0 Aug 29 17:24 spearNVhi2tmp1.ppm
> 0 Aug 29 17:24 spearNVhi2tmp2.ppm
> 0 Aug 29 17:24 spearNVhi2tmp3.ppm
> 0 Aug 29 17:30 spearNVhi3.ppm.ppm
>
> assembly of rows then full image fail as partials are not valid images
> (14 byte ones). Images with data assemble, but contain random x-window
> buffer weirdness: multi-virtual-desktop collages.
>
> Summary: the partial tiles are broken.
>
> I haven't tried it with just one workspace.
>
>
> minimizing the NVIZ window (before clicking "ok" for the output
> filename) gives the same result.
>
>
> at the end of the bug report Glynn offers a reason, but I have no idea
> where to go from there. Dumb debugging effort: I still get the broken
> result if I comment out "Nset_cancel_func update" in
> visualization/nviz/scripts/nviz2.2_script
> and rebuild nviz.
>
>
> ?
> Hamish
More information about the grass-dev
mailing list