Dark Bit Factory & Gravity
PROGRAMMING => Freebasic => Topic started by: WidowMaker [retired] 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.
-
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 = 100should be
const STARS = 100
Btw, the wormhole looks nice :)
-
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.
-
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 :)
-
It works, I would have never figured that out on my own.
Thanks.
K+
-
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.
-
@WidowMaker: I was watching your new intro (http://www.intro-inferno.com/production.php?id=7906) 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
-
:clap: Thank you sir. K+