POV-Ray : Newsgroups : povray.bugreports : pov 3.7 array and for strangeness Server Time
3 Nov 2024 08:46:40 EST (-0500)
  pov 3.7 array and for strangeness (Message 1 to 2 of 2)  
From: Leroy
Subject: pov 3.7 array and for strangeness
Date: 14 May 2023 17:20:00
Message: <web.6461437cd2bf0d2217fae25f712fc00@news.povray.org>
A while ago I made some POV code to turn a 2meg color tga (made by POV) into a
256 color palette pcx. This was for the old Quake2 game.

I used this in a mac to save the file:

   #local Tc=Image_Width * Image_Height;
   #for(a,0,Tc-1)
    #write (Mfile,uint8 Image[a])// The image array contain Integers<256
   #end
I had no problems, as the Image_Width & Image_Height where rather small 400*400.

Lately I tried to use the same code to save a much larger image array
(2048*1024)
The Image just didn't work. After going through the code a dozen times looking
for bugs. I decided to try and make the POV crash on purpose.
So I tried this.

   #local Tc=Image_Width * Image_Height;
   #for(a,0,Tc)//--- notice the change------
    #write (Mfile,uint8 Image[a])// The image array still contain Integers<256
   #end
POV didn't crash !?  And the image worked!!

To see what the output was I saved the Image array into POV file as an Named
array and ran that file to see if the array would work.
 neither of the codes above made a good array with out a lot of tweeking.

Not satisfied I tried this:

   #local Tc=Image_Width * Image_Height;
   #local a=0;
   #while(a<Tc)
    #write (Mfile,uint8 Image[a])
    #local a=a+1;
   #end
Everything worked as expected!!

So what ya think?

I've got:: POV version 3.7.0.RC7.mevc10.sse.win32 running on an winXP.

Have fun!!


Post a reply to this message

From: William F Pokorny
Subject: Re: pov 3.7 array and for strangeness
Date: 23 May 2023 07:22:29
Message: <646ca1f5$1@news.povray.org>
On 5/14/23 17:16, Leroy wrote:
> So I tried this.
> 
>     #local Tc=Image_Width * Image_Height;
>     #for(a,0,Tc)//--- notice the change------
>      #write (Mfile,uint8 Image[a])// The image array still contain Integers<256
>     #end
> POV didn't crash !?  And the image worked!!

I don't know why you see what you do.

In some quick tests on linux the parser always stops with an error once 
the array subscript goes out of range on the very last 'for loop' step. 
And I don't have problems with the larger array.

A wild guess is maybe the file handle (Mfile) isn't always getting 
closed in the SDL and the file buffering or render completion handling 
for open file handles not explicitly closed is in some way different on 
windows? It's a wild guess that I don't think the likely.

Bill P.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.