Author Topic: Odd Array bug using RBZ's framework.  (Read 4493 times)

0 Members and 1 Guest are viewing this topic.

Offline WidowMaker [retired]

  • %010101
  • Atari ST
  • ***
  • Posts: 134
  • Karma: 21
  • %010101
    • View Profile
Odd Array bug using RBZ's framework.
« on: November 07, 2009 »
I am scratching my head here..

I know what the problem is (I think) but I don't know why it is happening.
Please see the attached zip file.

I am making a wormhole which lots of stuff is going to fly out of, I decide to do a test with some gl_points, I made three arrays to hold points, declared some subs to control them, called the sub to fill the arrays with random points and then I tried to access those arrays in the program and it crashes instantly.

It seems like my arrays are never initialised, the sub to initialise the array is never called by the look of things, clearly I have got a few things wrong here.

Anyone want to give me a clue?

Thanks.


Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: Odd Array bug using RBZ's framework.
« Reply #1 on: November 07, 2009 »
Looks like blaming RBZ become popular these days, eh ? :D

I found 02 problems in your code:

1 - You can't execute a function (PREP_OBJ()) before your windows entry point "WinMain", so I suggest you to initialize all your intro data inside "glInit()".

2 - You can't create an array passing an integer to it, it should be a "constant". It's sad that FB compiler didn't spot that error.
Code: [Select]
  DIM SHARED AS INTEGER STARS = 100should be
Code: [Select]
  const STARS = 100
Btw, the wormhole looks nice :)

« Last Edit: November 07, 2009 by rbz »
Challenge Trophies Won:

Offline WidowMaker [retired]

  • %010101
  • Atari ST
  • ***
  • Posts: 134
  • Karma: 21
  • %010101
    • View Profile
Re: Odd Array bug using RBZ's framework.
« Reply #2 on: November 07, 2009 »
Quote
Looks like blaming RBZ become popular these days, eh ?

I wasn't blaming you for my bad code  :'( , just hoping that you'd see your name in the topic and reply, it is your framework and you would be the logical expert of it.

I spent the most of this afternoon trying to spot my mistake and I couldn't do it.

Anyway, thank you for the advice, I'll try that.


Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: Odd Array bug using RBZ's framework.
« Reply #3 on: November 07, 2009 »
Quote
Looks like blaming RBZ become popular these days, eh ?

I wasn't blaming you for my bad code  :'( , just hoping that you'd see your name in the topic and reply, it is your framework and you would be the logical expert of it.
...
Bear in mind that I was just kidding :)
Challenge Trophies Won:

Offline WidowMaker [retired]

  • %010101
  • Atari ST
  • ***
  • Posts: 134
  • Karma: 21
  • %010101
    • View Profile
Re: Odd Array bug using RBZ's framework.
« Reply #4 on: November 07, 2009 »
It works, I would have never figured that out on my own.

Thanks.

K+


Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Odd Array bug using RBZ's framework.
« Reply #5 on: November 07, 2009 »
if you want to be doubly sure STARS is an integer, const as integer STARS, its something ive recently got into with ints, singles and doubles, etc.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: Odd Array bug using RBZ's framework.
« Reply #6 on: November 28, 2009 »
@WidowMaker: I was watching your new intro and I found that strange bug again, when I move fast mouse pointer it seems that your intro drop FPS.
I've added a little fps counter and found it was in fact your timer counter code having problems, when the framework need to dispatch a message received by window your timer looses precision and your intro slow down, so just change this little piece of code and everything will be fine.

Code: [Select]
    while(wMsg.message <> WM_QUIT)

        if (PeekMessage (@wMsg,NULL,0,0,PM_REMOVE) <> 0) then
            DispatchMessage(@wMsg)
            DV=TIMER-OLD 'fixed: update timer when window process a message
        else
            OLD=TIMER
            glDraw()
            SwapBuffers (hdcWin)
            DV=TIMER-OLD
        end if
       
    wend
Challenge Trophies Won:

Offline WidowMaker [retired]

  • %010101
  • Atari ST
  • ***
  • Posts: 134
  • Karma: 21
  • %010101
    • View Profile
Re: Odd Array bug using RBZ's framework.
« Reply #7 on: December 05, 2009 »
 :clap: Thank you sir. K+