Windowed/Fullscreen

BlitzMax Forums/BlitzMax Beginners Area/Windowed/Fullscreen

Josepho(Posted 2007) [#1]
Hi, i have another question. I use the graphics function for changing between fullscreen [graphics 800,600,0,16,0)] and windowed [graphics 800,600,0,0,0)] but sometimes the game crashes telling me an unhanled memory exception, is this a bug or im using a bad function for this?


FlameDuck(Posted 2007) [#2]
Are you using EndGraphics?


Josepho(Posted 2007) [#3]
I use endgraphics() before using graphics, is that the rigth way?


JazzieB(Posted 2007) [#4]
I don't use EndGraphics and don't have any problems, since graphics are not unloaded from memory as they used to be in previous versions of Blitz (3D, Plus, etc).

EndGraphics does, however, free any graphics you may have loaded. In this case, you will need to reload any media in order to avoid the error you describe.

Also, are you fully up to date with version 1.24 of BlitzMax, as earlier revamped versions of the DX modules have seen some work that could cause errors also. These have now been fixed, so make sure you're fully synced and up to date.


Josepho(Posted 2007) [#5]
Oh, that was! I synced and then the problem is solved, thank you!


FlameDuck(Posted 2007) [#6]
EndGraphics does, however, free any graphics you may have loaded.
No it doesn't.


ImaginaryHuman(Posted 2007) [#7]
Flameduck maybe an explaination is in order?


H&K(Posted 2007) [#8]
I don't use EndGraphics and don't have any problems, since graphics are not unloaded from memory as they used to be in previous versions of Blitz (3D, Plus, etc).

EndGraphics does, however, free any graphics you may have loaded. In this case, you will need to reload any media in order to avoid the error you describe.
EndGraphics is the first command called when you call Graphics, so yes you are calling it.
There is infact no point going
EndGraphics
Graphics 800,600 (OR whatever)
Because AS said EndGraphics is already going to be called

This also means that you thinking that Graphics doesnt unload stuff, but that endgraphics does. Is simply wrong

Function Graphics:TGraphics( width,height,depth=0,hertz=60,flags=0 )

	EndGraphics
	flags:|_defaultFlags

	Local g:TGraphics=CreateGraphics( width,height,depth,hertz,flags )
	If Not g Return
..


Are you using EndGraphics?
Same as above. But still a valuable question, because maybe , ppl are staring the grpahics with
TGraphics.CreateGraphics ( width,height,depth,hertz,flags )



Grey Alien(Posted 2007) [#9]
I agree with FD. EndGraphics doesn't free any media you have loaded. My framework allows you to press F to flip between full-screen/windowed mode instantly with no reload required. Maybe the media needs to be reuploaded to the graphics card again (I'm not sure) but BMX handles this automatically the first time each image is drawn.


JazzieB(Posted 2007) [#10]
I know that BlitzMax handles all the moving of images between RAM and VRAM. As stated I don't manually use it myself and have options to switch resolution and modes in my own games that work with no issues.

I didn't know that EndGraphics got called with a Graphics call anyway, so assumed it's use to be one of closing the current graphics session and freeing up any images, and therefore RAM. Sorry if my assumption was wrong and caused confusion.

Regardless of all this EndGraphics malarky, the issue that Josepho was having has already been solved and nothing to do with his use of EndGraphics at all. His version of BlitzMax wasn't up to date and was using the DX modules that had problems with switching modes.