Strange Graphics Error

Blitz3D Forums/Blitz3D Programming/Strange Graphics Error

Hi everyone,
When I try to create an exe file, or run my program without debug enabled, I get an error saying "Unable to set Graphics Mode". Why is this, and what can I do to fix it?
Thanks for helping.

You can get this error ocassionally, usually when you have another graphics app running. If closing the other apps doesn't fix it, reboot and it should be OK.

Hmm... rebooting didn't work. Anything else that might?

Are you setting a 2D or 3D graphics mode? Infact, can we see some code?

ok... it's a very simple program.
AppTitle "Romules and Remus"
music = PlayMusic ("Eagleland__Onett.mid")
Graphics 611,349
SetBuffer BackBuffer ()
.start
intro = LoadImage ("tiberintro.bmp")
DrawImage intro, 0,0
Flip
begin$ = Input ("")
If begin$ = "" Then Goto slide1
.slide1
StopChannel music
music2 = PlayMusic ("sadness.mid")
Cls
Graphics 827,682
slde1 = LoadImage ("tiberbank.bmp")
DrawImage slde1, 0,0
Flip
WaitKey
Goto slide2
.slide2
StopChannel music2
music4 = PlayMusic ("notlike.mid")
Cls
Graphics 518,456
disagree = LoadImage ("disagree.bmp")
DrawImage disagree, 0,0
Flip
WaitKey
Goto slide3
.slide3
StopChannel music2
music3 = PlayMusic ("linktheme.mid")
Cls
Graphics 708,419
mount = LoadImage ("decide.bmp")
DrawImage mount, 0,0
Flip
WaitKey
Goto slide4
.slide4
StopChannel music3
music4 = PlayMusic ("fighting.mid")
Cls
Graphics 773,576
fight = LoadImage ("twinfight.bmp")
DrawImage fight, 0,0
Flip
WaitKey
Goto endshow
.endshow
StopChannel music4
endmusic = PlayMusic ("endmusic.mid.")
Cls
Graphics 522,403
endimg = LoadImage ("ending.bmp")
DrawImage endimg, 0,0
Flip
WaitKey
End

OK, that ran in debug because running in debug uses a window that can be set to strange sizes like 522x403, however, without debug on that will run in fullscreen and modes like 522x403 aren't supported!

You need to set a flag in the Graphics command to specify windowed mode (see docs).

Yeah, always specify the windowed mode explicitly, something like
Graphics 640,480,32,2

I always thought it was odd that it varies between fullscreen/windowed based on whether or not you are debugging, but if you set the flag explicitly then it won't matter.

You need to set a flag in the Graphics command to specify windowed mode (see docs).

That or use standard resolutions. Like 640x480, 800x600, 1024x768, etc.

Thanks everyone! This should solve my problem...

Any reason why you need to alter the screen resolution for each image?

Oh yeah, I didn't even think of that. wtf?

Any reason why you need to alter the screen resolution for each image?
I figured he just wants to do a slide show where each image is nicely framed in a window. It's a bit unorthodox but there's no real reason not to do it this way.

It's a bit unorthodox but there's no real reason not to do it this way.

As long as you do not try it in fullscreen mode.

As long as you do not try it in fullscreen mode.
We've already established that. ;)

Umm to add in, I believe there is a command of GFXModeExist or sumtin to check to see if the system supports it. And I usualy set all my parameters when calling graphics. IE.
"Graphics3D 1024,768,32,1"

@big10p
We've already established that. ;)

And why did you write this nonsense then? ;-)
It's a bit unorthodox but there's no real reason not to do it this way.

There is one ... it doesn't work in Fullscreen mode as I say again
and it makes no sense in Windowed mode because in this case the pictures are not fullscreen...
So what ? :-P

to quote big10p...

OK, that ran in debug because running in debug uses a window that can be set to strange sizes like 522x403, however, without debug on that will run in fullscreen and modes like 522x403 aren't supported!



RaGR: I suggest you read through the whole thread again - you seem to have missed the point. To sum up: he wants to use windowed mode, not fullscreen - that's why he's changing modes for each image.

As Ross C points out, I've already said it won't work in fullscreen mode. ;)