GLBasic forum

Main forum => Bug Reports => Topic started by: MrTAToad on 2011-Mar-17

Title: POLYVECTOR & Palm
Post by: MrTAToad on 2011-Mar-17
It appears that using POLYVECTOR crashes the program on a Palm Pre.  I think it was mentioned before - but you never know :)
Title: Re: POLYVECTOR & Palm
Post by: Ian Price on 2011-Mar-17
Err no it doesn't.

I've been using POLYVECTOR since day 1 and it works just fine.

See attached image - The board and the scrolling background are POLYVECTORs.

[attachment deleted by admin]
Title: Re: POLYVECTOR & Palm
Post by: MrTAToad on 2011-Mar-17
Thats odd - mine crashes right out...
Title: Re: POLYVECTOR & Palm
Post by: Ian Price on 2011-Mar-17
You're too quick - I've just edited my post to include a screenie.

B'lox! on Pre uses POLYVECTORs too. No problems so far.
Title: Re: POLYVECTOR & Palm
Post by: MrTAToad on 2011-Mar-17
Are you using 320x480 or the other way around?
Title: Re: POLYVECTOR & Palm
Post by: Ian Price on 2011-Mar-17
480x320 for both apps (and something completely new, plus tests).
Title: Re: POLYVECTOR & Palm
Post by: MrTAToad on 2011-Mar-17
Could you try this with with 320x480 :

Code (glbasic) Select
// ---------------------------------
// Project: Plasma
// Start: Wednesday, March 11, 2009
// IDE Version: 6.184

TYPE tCosTable
value
ENDTYPE

TYPE tColour
value%
ENDTYPE

TYPE TPlasma
cosTable[] AS tCosTable
colourTable[] AS tColour
screenWidth%;screenHeight%
wave%
stp%

FUNCTION Initialise_Plasma%:
LOCAL loop%
LOCAL cTable AS tCosTable
LOCAL cColour AS tColour

DIM self.cosTable[0]
DIM self.colourTable[0]

GETSCREENSIZE self.screenWidth%,self.screenHeight%

//  Create COS table
FOR loop%=0 TO self.screenWidth%*2
cTable.value=SIN(360.0*loop%/320.0)*32+32
DIMPUSH self.cosTable[],cTable
NEXT

FOR loop%=0 TO 255
cColour.value%=RGB(loop%,loop%,0)
DIMPUSH self.colourTable[],cColour
NEXT

self.wave%=0
self.stp%=14
ENDFUNCTION

FUNCTION Update_Plasma%:
LOCAL x%,y%
LOCAL pos1,pos2

INC self.wave%,3
IF self.wave%>320
self.wave%=0
ENDIF

FOR y%=0 TO self.screenHeight%-1 STEP self.stp%
        pos1 = self.cosTable[y%+self.wave%].value

FOR x% = 0 TO self.screenWidth%-1 STEP self.stp%
pos2 = (self.cosTable[x%+self.wave%].value + self.cosTable[x%+y%].value + pos1)
STARTPOLY -1
POLYVECTOR x%+self.stp%,y%,0,0,self.colourTable[self.cosTable[pos2].value].value
POLYVECTOR x%,y%,0,0,self.colourTable[self.cosTable[pos2].value].value
POLYVECTOR x%,y%+self.stp%,0,0,self.colourTable[self.cosTable[pos2].value].value
POLYVECTOR x%+self.stp%,y%+self.stp%,0,0,self.colourTable[self.cosTable[pos2].value].value
        ENDPOLY
        NEXT
   NEXT

   ENDPOLY

ENDFUNCTION
ENDTYPE

LOCAL plasma AS TPlasma

plasma.Initialise_Plasma()
WHILE TRUE
plasma.Update_Plasma()
SHOWSCREEN
WEND


Its my animated plasma routine...

Ah - interesting thing is that using 320x480 on Windows also crashes it :)

Ahh - does look like an out of bounds problem with this resolution - ah good :)

Yes, it should be quite alright...
Title: Re: POLYVECTOR & Palm
Post by: Ian Price on 2011-Mar-17
QuoteAh - interesting thing is that using 320x480 on Windows also crashes it :)
Confirmed - it does indeed crash on Windows at 320x480. No point in trying it on the Pre - result will be the same.
Title: Re: POLYVECTOR & Palm
Post by: MrTAToad on 2011-Mar-17
yes - it was my code causing the problem.  Which is good :)
Title: Re: POLYVECTOR & Palm
Post by: Kitty Hello on 2011-Mar-22
Running in debug mode, I get:
Code (glbasic) Select

pos2 = (self.cosTable[x%+self.wave%].value + self.cosTable[x%+y%].value + pos1)

bounds: [ 641]
access: [ 644]
"C:\Users\GF\Documents\GLBasic\_support\_support.gbas"(59) error : Ausserhalb des DIM Bereichs


So it's an out of bounds error.
Check the cos/sin table size and what you call it with.
Title: Re: POLYVECTOR & Palm
Post by: MrTAToad on 2011-Mar-22
Yes, it was a bounds problem :)