Graphics issues

BlitzMax Forums/BlitzMax Programming/Graphics issues

William Drescher(Posted 2009) [#1]
Okay, so I got this awesome new computer for christmas and I booted it up and installed BlitzMax and tried to run a simple program and it gave me the error "Unhandled Exception: Attempt to access field or method of Null object" on a Cls call. What in the world caused this?


Jesse(Posted 2009) [#2]
did you set the graphics mode?
can you post the code?


William Drescher(Posted 2009) [#3]
Graphics 800, 600

While Not KeyHit(KEY_ESCAPE)
    Cls
    DrawText "Hello World", 60, 60
    Flip
Wend
End



_Skully(Posted 2009) [#4]
Try... SetGraphicsDriver GLMax2DDriver() for shits and giggles.


Jesse(Posted 2009) [#5]
I think you need to rebuild modules but for that you need to install MinGW.


_Skully(Posted 2009) [#6]
ya thats your best first step


xlsior(Posted 2009) [#7]
Could also be that your computer doesn't support 800x600 full screen mode -- on some of the newer widescreen monitors the smallest that's supported is 1024x768.

Run this, and see if it's even a valid option:

Print "Available graphics modes:"

For Mode:TGraphicsMode=EachIn GraphicsModes()

	Print Mode.width+","+Mode.height+","+Mode.depth+","+Mode.hertz

Next



dmaz(Posted 2009) [#8]
800x600 will be valid no matter what because he's attempting to open within a window... not fullscreen.


ziggy(Posted 2009) [#9]
Maybe this new computer has vista or win7 and does not come with DX9 (DX10 instead).
try adding SetGraphicsDriver OpenGL this way:

'We see what's the default graphics driver in your computer, if any:
If GetGraphicsDriver() <> Null Then 
   Print "Previous graphics driver:" + GetGraphicsDriver().ToString()
else
   Print "No graphic driver was available as 'default'."
endif
SetGraphicsDriver GLMax2DDriver()
Print "Current graphics driver: " + GetGraphicsDriver().ToString()
Graphics 800, 600

While Not KeyHit(KEY_ESCAPE)
    Cls
    DrawText "Hello World", 60, 60
    Flip
Wend
End

And see if it does make any difference, and what output do you get.


William Drescher(Posted 2009) [#10]
Well I decided to rebuild the modules and that seemed to fix the problem. If it helps, I'm on an Acer Aspire One running Win7 Starter. I tried OpenGL and the Max2D driver and they didn't work either until I rebuilt the modules. I'm still confused on what was causing this problem.


Jesse(Posted 2009) [#11]
it is possible that the modules are not ready built when BlitzMax is Installed. However, I am unable to confirm sense I have a habit of rebuilding modules right after installing BM.