This code doesn't work on PB3.93

Just starting out? Need help? Post your questions and find answers here.
aaron
Enthusiast
Enthusiast
Posts: 267
Joined: Mon Apr 19, 2004 3:04 am
Location: Canada
Contact:

Post by aaron »

Works fantasic on my laptop! That's a pretty awesome effect. I've got an ATI Radeon IGP 320 chipset.

Don't know whats wrong with the rest of your guys chipsets. :lol: Guess you other ATI guys need to update drivers. 8)
Pupil
Enthusiast
Enthusiast
Posts: 715
Joined: Fri Apr 25, 2003 3:56 pm

Post by Pupil »

aaron wrote:Don't know whats wrong with the rest of your guys chipsets. :lol: Guess you other ATI guys need to update drivers. 8)
I've already done that, right after i tested the code the first time, but it didn't help.
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Post by traumatic »

Well, if I got him right, Psychophanta said it worked for him in previous
PB Versions so it can't be a mere driver issue, can it?

I can't tell because it works for me ;)
Good programmers don't comment their code. It was hard to write, should be hard to read.
LuCiFeR[SD]
666
666
Posts: 1033
Joined: Mon Sep 01, 2003 2:33 pm

Post by LuCiFeR[SD] »

it doesn't work in PB V3.90 for me either.... so perhaps it is just driver issues? It maybe the newer drivers that have broken something, not pb at all :) it could even be a service pack 2 issue with XP. I'll test in 98 in a while
aaron
Enthusiast
Enthusiast
Posts: 267
Joined: Mon Apr 19, 2004 3:04 am
Location: Canada
Contact:

Post by aaron »

Pupil wrote:I've already done that, right after i tested the code the first time, but it didn't help.
I just checked out my driver... looks like I'm running a really old version (from 5/15/2003), version 6.14.10.6451. For the record, my ATI card is a Mobility Radeon 9200.

I'm running purebasic 3.93a, winXPsp2.

So I guess the answer is to downgrade the drivers instead of upgrade. :lol:
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

Post by Dreglor »

This has always done this with pb (not with other things though) i just bought a 9600 pro and it seams to do it too (and this thing happened also with my 9100) it the windowed buffer put it into full screen it works but theres a balck screen that phases you
it sound more of an issue with compatablity with pb, windows (and windowed screen) and ati o_O
~Dreglor
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

traumatic wrote:
eevee wrote:Crashes will Illegal Op.
Seems like you're the winner! :mrgreen:
:lol: lol
traumatic wrote:Psychophanta said it worked for him in previous PB Versions
Sorry, not sure. I have another pc with nvidia geforce 400mx, and i'm not sure if it was tested on it. :?
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

The code is not correct as DrawingBuffer() need to be called at each loop, because the memory surface format can change. Here is a working one:

Code: Select all

; converted from bb code
; edited by webmatze
; turn debugger off for performance..

#appWidth = 640
#appHeight= 480

; Structure LONG    ; Structure already declared in PB3.70+
;   l.l
; EndStructure

Dim Palette.l(255)
Dim table.l(#appWidth, #appWidth)


Procedure SetupPalette()
  ; create a temporary image...
  CreateImage(0, #appWidth, #appHeight)
  ; ...to draw a nice colour-pattern onto it
  StartDrawing(ImageOutput())
    For i = 0 To 63
     LineXY(i,0,i,200, RGB(0, 0, i*4))
    Next

    For i = 0 To 127
     LineXY(i+64,0,i+64,200, RGB(0, (i/2)*4, 63*4))
    Next

    For i = 0 To 63
     LineXY(i+192,0,i+192,200,RGB(i*4, 63*4, 63*4))
    Next
  ; grab palette data
  For x = 0 To 255
   Palette(x) = Point(x,0)
  Next
  StopDrawing()

  ; clean-up
  FreeImage(0)
EndProcedure

Procedure PreCalc()
  For y = 0 To #appHeight
   For x = 0 To #appWidth
    If x = 0 And y = 0
     table(y,x) = 255
    Else
     table(y,x) = (9000000000 / (Sqr(x*x + y*y) * 250000))
    EndIf
   Next
  Next
EndProcedure


If InitSprite() = 0
  End
EndIf

OpenWindow(0, 0, 0, #appWidth, #appHeight, #PB_Window_SystemMenu | #PB_Window_ScreenCentered, "testing...")
OpenWindowedScreen(WindowID(), 0, 0, #appWidth, #appHeight, 0, 0 ,0)

SetupPalette()
PreCalc()

halfW.l = #appWidth/2
halfH.l = #appHeight/2


Repeat

  If WindowEvent() = #PB_Event_CloseWindow
    quit.b = 1
  EndIf
 
  ; fps
  If GetTickCount_() => zeit + 1000
    FrameSek = Frames
    Frames = 0
    zeit = GetTickCount_()
  Else
    Frames + 1
  EndIf

  FlipBuffers()

  cosAlfa.f = Cos (alfa.f)
  cosAlfam.f = Cos (-alfa)
  cosAlfa2.f = Cos (alfa*2)
  cosAlfam2.f = Cos (-alfa*2)
  sinAlfa.f = Sin (alfa)
  sinAlfam.f = Sin (-alfa)
  sinAlfa2.f = Sin (alfa*2)
 
 
 
  x1.f = 60 * cosAlfa  + 30 * sinAlfam  + halfW
  y1.f = 30 * cosAlfam2 + 60 * sinAlfa   + halfH
  x2.f = 30 * cosAlfa    + 60 * sinAlfa2 + halfW
  y2.f = 60 * cosAlfa    + 30 * sinAlfa   + halfH
  x3.f = 45 * cosAlfam   + 45 * sinAlfa   + halfW
  y3.f = 45 * cosAlfa2  + 45 * sinAlfam  + halfH
  x4.f = 75 * cosAlfa    + 15 * sinAlfa2 + halfW
  y4.f = 15 * cosAlfam   + 75 * sinAlfa2 + halfH
  x5.f = 35 * cosAlfa    + 10 * sinAlfa   + halfW
  y5.f = 10 * cosAlfa2  + 35 * sinAlfam  + halfH
  x6.f = 40 * cosAlfam   + 30 * sinAlfa2 + halfW
  y6.f = 40 * cosAlfa    + 10 * sinAlfa   + halfH


  alfa.f+0.05
  
  If StartDrawing(ScreenOutput())
    *Screen.LONG = DrawingBuffer()

    byte_pixel.b = Round((DrawingBufferPixelFormat() + 1)/2, 1)
    byte_line.l = DrawingBufferPitch()
    bufferadr = *Screen

    For y = 0 To #appHeight Step 2
      a1.l = Abs(y1-y)
      a3.l = Abs(y2-y)
      a5.l = Abs(y3-y)
      a7.l = Abs(y4-y)
      a9.l = Abs(y5-y)
      a11.l = Abs(y6-y)
      *screen1.LONG = bufferadr + y*byte_line
      *screen2.LONG = *screen1 + byte_line
      For x = 0 To #appWidth Step 2
          a2.l = Abs(x1-x)
          a4.l = Abs(x2-x)
          a6.l = Abs(x3-x)
          a8.l = Abs(x4-x)
         a10.l = Abs(x5-x)
         a12.l = Abs(x6-x)

        pixel.l = table(a1, a2) + table(a3, a4) + table(a5, a6) + table(a7,a8) + table(a9, a10) + table(a11, a12)
       
        If pixel>255
          pixel=255
        EndIf
       
        pixel = palette(pixel)
       
        *screen1\l = pixel
       
        *screen1 + byte_pixel
        *screen1\l = pixel

        *screen2\l = pixel
       
        *screen2 + byte_pixel
        *screen2\l = pixel
       
        *screen1 + byte_pixel
        *screen2 + byte_pixel
      Next
    Next

    FrontColor(0, 0, 0)
    DrawingMode(0)
    Locate(5,452)
    DrawText("FPS: "+Str(FrameSek))
    StopDrawing()
  EndIf

Until quit = 1 
olejr
Enthusiast
Enthusiast
Posts: 152
Joined: Sun Jul 11, 2004 7:48 pm
Location: Lillehammer, No(r)way
Contact:

Post by olejr »

Well just for the record. None of these work on my machine.. :?
Crash with one of those cute MS requesters, letting me tell MS about the problem..

XP Pro SP2, PB 3.93 and GeForce4 Ti 4400 with the latest drivers.
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Now works, that's it, Fred :D
olejr wrote:Well just for the record. None of these work on my machine.. :?
Crash with one of those cute MS requesters, letting me tell MS about the problem..

XP Pro SP2, PB 3.93 and GeForce4 Ti 4400 with the latest drivers.
Please check userlibs and try with a clean PB 3.93 installed.
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
olejr
Enthusiast
Enthusiast
Posts: 152
Joined: Sun Jul 11, 2004 7:48 pm
Location: Lillehammer, No(r)way
Contact:

Post by olejr »

Psychophanta wrote:Please check userlibs and try with a clean PB 3.93 installed.
Just reinstalled Xp some days ago, and a clean PB 3.93 too
Then did a smartupdate at the end, just to make sure I had all the updates..
The userlibs part is out of the question, as I haven't had the time to install any.. :wink:
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Then, So strange :shock: . Perhaps some kind of incompatibility. I didn't make this snip, but should work on any PC.
I would check drivers or something... :?
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
olejr
Enthusiast
Enthusiast
Posts: 152
Joined: Sun Jul 11, 2004 7:48 pm
Location: Lillehammer, No(r)way
Contact:

Post by olejr »

Well I have no idea what driver that could be..
Everything that should matter, is up todate..
And those that doesn't matter is also the latest..

And yeah.. It should work on any computer. There's nothing special in there.. :?
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

I can confirm that Fred's version of the code is working fine :D
LuCiFeR[SD]
666
666
Posts: 1033
Joined: Mon Sep 01, 2003 2:33 pm

Post by LuCiFeR[SD] »

Fred, thats perfect now. Working as expected. I do like that little effect, looks sweet :)
Post Reply