How to detect graphic modes

Blitz3D Forums/Blitz3D Beginners Area/How to detect graphic modes

PowerPC603(Posted 2004) [#1]
Hi,
I created a small initialization-screen for my game, where the user can select the gfxcard and the resolution to use for the actual game.

P.S.: Don't mind that logo (the 3D rendered text "SpaceGame").
This is where the actual logo must be displayed.
That was just a test about positioning images over other images.
Later on, I just have to replace that logo (is a different file) with the new one, and the interface is automatically updated.

Screenshot:


Only the optionsbuttons on the top-right portion of this window actually work, as the rest isn't programmed yet.

This screen is the first thing the player will see when he runs the game-exe and is displayed as a 2D-window (using the Graphics-command).

Each time the player selects another "Graphics driver:" (on the top-right), the game selects the selected gfxcard (with the SetGfxDriver-command).

But the question is: how will this run if the user selects a Voodoo-card (or similar card, which don't do 2D)?

Will the window still be visible, or does the player get an error-message?

Or should I only set the gfxdriver when the player clicks the "Run game" button?
If I do this, how can I detect all other gfx-modes on the selected card, when it isn't active (by the SetGfxDriver-command)?


PowerPC603(Posted 2004) [#2]
I got another idea a few minutes ago.

What if I would loop through all available graphics drivers and automatically select the first one with 3D-capabilities?
And display the window with the Graphics3D-command, instead of the Graphics-command?
And if the user has no 3D-capable card, display an error-message.

How do other games do this (that don't allow you to select the gfx-driver to use)?


WolRon(Posted 2004) [#3]
how will this run if the user selects a Voodoo-card (or similar card, which don't do 2D)?
If the card doesn't accelerate 2D then the operating system does the drawing. No problem.

What if I would loop through all available graphics drivers and automatically select the first one with 3D-capabilities?
I'm not sure but could this be a problem? What if your accessing the card causes a crash? Since the program would check all cards every time it starts up, it would always crash. Maybe it's better to let the user manually choose?


PowerPC603(Posted 2004) [#4]
I've never heard that checking a graphics driver for 3D-capability causes crashes.
But I've got only 1 pc at home and cannot check it on other systems.

But I've created the routine to do it (check for 3D-capability) and select the first 3D-card.

; Get the number of graphics drivers available in a user's system
GfxCardCount% = CountGfxDrivers()

; Select the first 3D-capable card
For i = 1 To GfxCardCount%
	If GfxDriver3D(i) = True Then
		SetGfxDriver i
		Exit
	EndIf
Next

; Set window for displaying the init-screen (see screenshot above)
Graphics3D 640, 480, 0, 2



Maybe it's better to let the user manually choose?



What if the user selects a card that Blitz reports as 3D-capable, and crashes if he selects it?
That would cause the same crash.

But currently, on startup of the game, the interface also checks all cards for 3D-capable modes, as the user will not be allowed to select a 2D-card for the game (because it will be entirely 3D).
The optionbutton in front of the card's name will be greyed out if it doesn't do 3D.
Then either way, the program would crash in both situations, if just checking the driver for 3D-capabilities causes a crash.


WolRon(Posted 2004) [#5]
What if the user selects a card that Blitz reports as 3D-capable, and crashes if he selects it?
That would cause the same crash.
Yes, but if it did, then the user would know not to select that one again in the future. Whereas, if your program ALWAYS checks it, it will always crash.

But, I could be way wrong here. Maybe checking 3D caps. won't ever cause a crash.


PowerPC603(Posted 2004) [#6]
I could also make the program scan all cards only the first time.
When the user has selected the required card, a settingsfile will be generated, where the user's selection is stored.

Next time the game is started, it will check if the file exists, and if it does, load it and skip scanning the cards.

But one more question:
When the user selects a card and resolution, should I immediately select the graphics card, using SetGfxDriver()?
Or is it best to only set the driver when the user clicks the "run game"-button and check if that resolution is supported for that card (and if not, redisplay the interface and give an error-message, stating that the user has to select another resolution)?

Because currently, when the user selects a different driver than the first one, the interface-images should transfer to the new card.
What if the interface is loaded and displayed with a pure 2D card (e.g. onboard gfx-driver), and the user selects it's AGP-card (that was not selected as a default)?
Then all images were loaded into the RAM of the onboard gfxdriver, and when the user selects the other card, it doesn't have anything to display.

Or am I totally wrong here?
I wonder how other games do this.