• Welcome to Dark Bit Factory & Gravity.
 

Odd Array bug using RBZ's framework.

Started by WidowMaker [retired], November 07, 2009

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

WidowMaker [retired]

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.


Rbz

#1
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.
  DIM SHARED AS INTEGER STARS = 100
should be
  const STARS = 100

Btw, the wormhole looks nice :)

Challenge Trophies Won:

WidowMaker [retired]

QuoteLooks 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.


Rbz

Quote from: WidowMaker [retired] on November 07, 2009
QuoteLooks 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:

WidowMaker [retired]

It works, I would have never figured that out on my own.

Thanks.

K+


Clyde

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:

Rbz

@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.

    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:

WidowMaker [retired]