BlitzMax error trying to build/run an example...

BlitzMax Forums/BlitzMax Programming/BlitzMax error trying to build/run an example...

Noble(Posted 2006) [#1]
Here is the program that I created and tried to build/run:

' =============================================================================
' Display Game Play Screen
' =============================================================================

Global image : TImage = LoadImage("screen2.png")


Graphics 800,600


Repeat
DrawImage(image,0,0,0)
Flip
Cls
Until KeyDown(Key_Escape)

End


I get a popup window with this error:

"Unhandled Exception: Attempt to access field or method of null object"

I have the path and image correct, I am using the latest DX and have 525MB free memory. I am using Windows XP Pro

Help!!! I just purchased BlitzMax today.

Thanks in advance and God bless.

nb


Nicholas(Posted 2006) [#2]
Are you sure it is loaded ?

Try Global image : TImage = LoadImage("screen2.png")

Graphics 800,600


Repeat
if image
DrawImage(image,0,0,0)
endif
Flip
Cls
Until KeyDown(Key_Escape)

End

And see if the image appears - if not, then its not being loaded.


Noble(Posted 2006) [#3]
Thanks for your reply. That did not work. It still returns the messagebox with the error. (When run in the ide). If I run the .exe file it just locks up my computer and I have to stop the task from runnning.

So...

I put a print "hello" statement right after the "if image" to see if it was evaluating properly and it is so the error is not steming from the image not loading.

Any other thoughts?

Thanks,
nb


marksibly(Posted 2006) [#4]
What line is the error occuring on?

Do any of the samples work? Do any of them not work?

Try a differrent graphics mode too - say 640,480.


tonyg(Posted 2006) [#5]
If you purchased Bmax today did you update and syncmods to the latest release? (e.g. what release of Bmax?)
Does this work :
'setgraphicsdriver glmax2ddriver()
graphics 800,600
drawrect 0,0,200,200
flip
waitkey()

Try it without and without the setgraphicsdriver commented.


Noble(Posted 2006) [#6]
Nothing works.. None of the demos or nothing. The demo version of BMax would not build/run the files either.

I purchased it because it DOES work on my home computer. Just not the one here at the office. Don't understand why though.


Noble(Posted 2006) [#7]
@tonyg - No that code does not work either. It returns the same messagebox error.

@marksibly - The error is on the line with the draw image command.


skidracer(Posted 2006) [#8]
Noble, can you try the firepaint sample which uses OpenGL not DirectX.

Also, when Mark asked what line it crash on, if you are in debug mode the debug panel of the IDE's navbar will have which function in which module the code crashed. If you double click on the bottom most node, it should take you to the line of the internal function being called at the time which may tell us more about what is going on.


tonyg(Posted 2006) [#9]
... you do have a 3D graphics card on that machine... don't you?
If it works on one and not on another then post the specs for both.


Noble(Posted 2006) [#10]
@tonyg - It's a Sis 650 on-board graphics card. It is not a physical card nor is the one that I have at home either.

@skidracer - No the firepaint demo just turns my start bar into 640x480 size and then locks up the computer.

This is really weird because I was able to download and use Blitz3d demo just fine and was able to run all the demos just fine.

nb


skidracer(Posted 2006) [#11]
Can you please test windowed mode:
graphics 640,480,0
waitkey



Noble(Posted 2006) [#12]
@skidracer - It displays the window mode but I cannot hit a key to close or push or click the X to close. I have to click the Stop button in the IDE. But it does bring up a window.


marksibly(Posted 2006) [#13]
Sounds like something's nastily stuffed.

Have you rebooted your machine lately?


Noble(Posted 2006) [#14]
@marksibly - Yes, several times. I have even ran Windows Crap Cleaner to get rid of all the tmp files, etc..


skidracer(Posted 2006) [#15]
And just to rule out it not being something wierd with audio or joystick:
Framework brl.d3d7max2d
Graphics 640,480,0
WaitKey



Noble(Posted 2006) [#16]
@skidracer - That worked too but still had to click on stop in the ide to close.


skidracer(Posted 2006) [#17]
OK, sounds like something quite unique or perhaps a corrupted install.

If everything is standard on the machine - no odd peripherals of any nature, plain xp install without any odd third party programs or security systems or windows enhancements (blinds?) and no other apps running (net meeting or remote desktop in particular) I would try a fresh download and install.


Noble(Posted 2006) [#18]
@skidracer - Nothing on this machine that I can think of that is out of the norm. I have installed it three times. I would uninstall. Re-download the files. Run the Windows Crap Cleaner. Reboot. Then re-install.

I guess it is just hopeless on this machine. :(


skidracer(Posted 2006) [#19]
If Blitz3D is still running fine it is probably worth our while continuing to investigate. Our blitzmax DX7 drivers have been tweaked recently so they should be very similar to b3d, I was actually using onboard sis graphics earlier in blitzmax development so it may be time to return to that config to see if I can't reproduce the problem.


Noble(Posted 2006) [#20]
@skidracer - I am game, just tell me what you would like me to do or try and I will help as much as I can.


marksibly(Posted 2006) [#21]
Also, have you tried using 'synchronize modules' from the program menu yet?


skidracer(Posted 2006) [#22]
to rule out your blitzmax install please verify the following hangs and you can't press a key or close the window (compiled version of my last code post):

http://www.gamecodenow.com/nitrologic/testmax.zip

i've just ripped out my gfx card and am testing with my sis616FX onboard graphics with no problems, from desktop properties settings what exactly does it say? i've got:

PlugandPlayMonitor on SiS 661FX
ScreenRes=1024x768,32bit

from startmenu->run type dxdiag, click on display tab, then try the Test Direct3D button

if it's a standalone system and you can do windows updates, go startmenu->windowsupdates, click custom, and make sure there are no hardware updates listed on the left


Leiden(Posted 2006) [#23]
@Noble: Clicking the close button on the window wont work as its waiting for a keypress, its not handling system messages. Its weird how your keypress isnt being recognised?

You can try this:
Graphics 800, 600, 0

While 1
	PollEvent()
	
	Select EventID()
		Case EVENT_APPTERMINATE
			End
	End Select
Wend
End


This version checks for windows events. Does clicking the X close the window?


Noble(Posted 2006) [#24]
- The testmax.zip will load the window. I can then click on a button and it will go away.

- SyncMaster 730B(Analog) on Sis 650_651_M650_740
ScreenRes = 1024x768,32bit

- DX Test = 7,8,9 were all sucessful

- There were NO hardware updates that needed to be installed.


I will be away for a few hours, going to celebrate my 38th birthday. Yay!


Leiden(Posted 2006) [#25]
You mean clicking the close button on the testmax window will make it go away? For me that did nothing, a keypress made the window go away.


Noble(Posted 2006) [#26]
Anybody have anymore suggestions? Again, Bmax works fine on my machine at home.

My home specs are:
Plug and Play Monitor on ATI Radeon Xpress 200
1024x768, 32bit
Latest Direct X
3.2ghz, 512mb, AMD

nb


skidracer(Posted 2006) [#27]
Did you answer Mark's question above?


Noble(Posted 2006) [#28]
@skidracer - Yes. It did not help at all. Same results. :(


marksibly(Posted 2006) [#29]
Hi,

Alas, I can't really think of anything else to try. It looks like BlitzMax just doesn't like your setup for some reason.

Please note that you can always get a full refund - just contact support@....


Noble(Posted 2006) [#30]
No, BlitzMax works fine on my machine at home (this is where I intend to use it). I just can't get it to load here at my work (where I have free time to learn how to use it).

It is not a big deal because it works GREAT at home and you guys here have been GREAT at trying to help me figure out the problem. Kudos! Who knows, we might stumble upon the solution soon.

nb


Mark Tiffany(Posted 2006) [#31]
From reading the above exchange, is the following statement true:

blitzmax apps compiled on your work PC do not work; blitzmax apps compiled on another PC (like testmax.zip above) do work.

Odd.


BlackSp1der(Posted 2006) [#32]
Maybe problems with MinGW


skidracer(Posted 2006) [#33]
Noble, make sure you are in debug mode and when you get the unhandled exception, click ok, then go to the debug tab of the NavBar in the IDE.

It should include a treeview of the command stack, with the bottom node being the actual function the error ocurred. If you can double click on this node the IDE should load the module file and position the cursor on the line it crashed. The file and line number may be of interest to us in working out what exactly is going wrong on your system.


Noble(Posted 2006) [#34]
@Mark - You are somewhat correct. The "testmax" works on both.

@skidracer - I will do that tomorrow when I return to my office and let you know what I find out.

nb


Noble(Posted 2006) [#35]
Here is the current situation. I downloaded the latest video drives for the SiS card from their website.

I also went into my BIOS settings and changed the amount of available video card ram from 32mb to 64mb which is the largest.

I tried the program again with ANY of the example programs and now this is what happens:

The program compiles and when it starts to run it turns my 1024x768 screen into a 640x480 screen with only the start bar present at the bottom the rest of the screen is black. The mouse pointer is an hourglass and I can move it around. It's not locked up.

I can do a CTRL+ALT+DEL and return to the IDE and select STOP and then program stops, everything goes away and the screen returns to normal 1024x768 resolution.

Things are getting really weird. I am convinced that it has something to do with this machine and this machine only as it works on my home computer without ANY problems.

nb


Noble(Posted 2006) [#36]
I am going to work on this in my spare time. If someone has any suggestions or someone comes up with a fix then PLEASE let me know.

You can reach me at: email at noblebell dot com


LarsG(Posted 2006) [#37]
Sounds like something backfires when the graphics screen tries to init...
Maybe Mark or Skid can yank out a debug "version" of the C graphics setup, and try that...


Noble(Posted 2006) [#38]
That is what I am hoping for. I don't know what else to do here.


skidracer(Posted 2006) [#39]
The testmax.zip will load the window. I can then click on a button and it will go away.


That test app should only close when you hit a key. If you can close the app by pressing the close button there is something very very wrong.

It reminds me of when we use to have problems with software mouse pointers, I would try display->properties->troubleshoot and turning down hardware acceleration, I think there is a setting that will kill fancy mouse pointer stuff but leave DX enabled.

Does this code get to the notify?
Framework brl.d3d7max2d
Graphics 640,480,0
Notify "hello"
WaitKey
Notify "goodbye"

After a keypress does it get to the second notify?
If not we can either try stepping through the Graphics code with the debugger or just some information about the gfx state if something like the following crashes:
Framework brl.d3d7max2d
Graphics 640,480,0
Cls
DrawText "hello",0,0
Flip
WaitKey

If it does crash you need to double click the lowest entry in the debug tab of the navbar, quote us the error message and line number the IDE takes you to and if possible deduce which object is null from the debug information when you unfold the lowest callstack node.

If it doesn't we could try LarsG suggestion and set you up with a debug version of the dx api and see if that spouts something.


Noble(Posted 2006) [#40]
I will try this on Monday morning when I get back to the office and see what happens. It's the weekend!! Yay!

I will let you know the results..

nb


Noble(Posted 2006) [#41]
@skidracer:

Alright, I got around to testing the two examples in your post.

1) The Test App ONLY closes when you hit a key. That is correct.

2) This Code:
Framework brl.d3d7max2d
Graphics 640,480,0
Notify "hello"
WaitKey
Notify "Goodbye"

It never makes it to the first notify window. Here is what it does:

It draws the graphics window with a black content area and the mouse pointer becomes an "hourglass". I can move the window around on the screen. If I hit the red "x" nothing happens. When I press a key on the keyboard the content area in the window goes from black to white and the mouse pointer, "outside of the content area" returns to a normal pointer. If you put the pointer into the content area it becomes an hourglass again.

At this point I hit the red "x" and get the "End Program" dialog where it tells me the program, untitled.exe, is not responding. I click "End Now". After a few moments I get the "Non Responsive Program" dialog and I click "Don't Send" and the world comes back to normal.

There is no way that I can get into debug mode to check anything. I cannot even step through the code. (Unless I am doing something wrong.)

3) This code:
Framework brl.d3d7max2d
Graphics 640,480,0
Cls
DrawText "hello",0,0
Flip
WaitKey

This code des the SAME THING that is in step 2.

nb


skidracer(Posted 2006) [#42]
Noble, there should be a new blitzmax update coming out soon. From what I read I had misunderstood and thought the test app binary I had posted was also locking up, if it is working correctly hopefully it won't be a long wait and the next public update will work better for you on this machine.


Noble(Posted 2006) [#43]
Looking forward to it. Keep up the good work..


Markus Rauch(Posted 2006) [#44]
i have a similar old fuc*ing sis 2MB grafikcard at my office
and it is possible to bring blitzmax and blitz3d to run
but it was not easy and i try any resolution/bit depth/
window/fullscreen/dx or opengl mode :)
i think the bad thing is Windows 2000 at my office .


marksibly(Posted 2006) [#45]
Moving this to programming as I suspect it's unfixable but if you guys want to keep hacking away, go for it...


North(Posted 2006) [#46]
my best hack - put a 10$ gfx card in your office machine and fire away ;)

No seriously i had lots of weird problems with this dinosaur here at work. It has an onboard Intel gfx chip. A cheap card made it work.