Change Resolution Caption.

Blitz3D Forums/Blitz3D Programming/Change Resolution Caption.

Yue(Posted 2011) [#1]
Hi there if someone gives me a help on how to do the following.

I have a function that returns the position where I found a graphic available, such as graphics mode 800 x 600 32, tells me that at position 11, this value is the same for all graphics cards?

Now what I need is to scan all possible modes supported by a graphics card, and display their values supported for the user to choose according to your taste.

Initially I thought that if that value was the same on all computers that function returns me it would be easy but I do not think so.

So hopefully aid, guidance.

A greeting.


xlsior(Posted 2011) [#2]
No, the value will not be the same on all cards.

It returns a list of the resolutions available on your computer. Not all computers have the same capabilities -- some may only only a few compatible resolutions, while others may have dozens.

for example: most computers with an LCD screen will only support a 60Hz refreshrate. The same computer with an old CRT could support the same resolutions at 60Hz, 70Hz, 72Hz, 80Hz, 85Hz, 100Hz, 120Hz, etc. making a MUCH longer list of options. Since they are sorted by resolution, it means that what would be on spot 11 on your computer with LCD could end up on spot 30 on the same computer with a CRT.

The value of '11' is completely arbitrary, and doesn't mean anything.


Yue(Posted 2011) [#3]
But then what I do is to refer to the initial mode with this function if every computer change, what I do is put it in a variable, but what is not and I have no idea how to implement the corresponding width and height of each mode for the user to choose correctly.

I think the best would be to use the most used modes .... I think 32 may be 800x600, 800x600, 16, 1024x768x32 ...

But I really want to scan all potential offered by the computer and displayed on signs.


Yasha(Posted 2011) [#4]
The best way really is to do this dynamically, and reload the list every time the user looks at the options screen. It'll be fast enough, if that's what you're worried about.


Axel Wheeler(Posted 2011) [#5]
I think pretty much every system has 800x600x32, 1024x768x32, 1280x1024x32, so you could just offer those and be done with it and not have to look up anything on the card itself.

The problem with this approach is the newer wide screen monitors, which have different aspect ratios. If you include those in your list they could cause an error if the user picks it on a system that doesn't support it.

So, Yasha's method is better but takes some work to implement. There was a nice little mode chooser in the code archives but I can't find it now. Does anyone remember where it was?


Yue(Posted 2011) [#6]
Hello, if I think it is clear that blitz3d can detect all graphics modes specified by the final user card, but this can be deduced that this error, eg blitz3d detected a very little, which is not compatible with direcx7, I am right?

On the other side and found a way to retrieve data for display in options and at the click of a button to display the next and the next.

Now need to implement it properly, having in mind the width, height and depth.

Graphics3D 800,600,32,False
SetBuffer BackBuffer()

Local MS = CountGfxModes3D()

Local MG[50]
Local MD[50]

For X = 1 To MS
	
	
	MG[X] = GfxModeHeight(X)
	MD[X] = GfxModeDepth(X)
	

Next 
Print MG[1]
Print MG[2]

Print "======================"

Print MD[1]
Print MD[2]

WaitKey()



Axel Wheeler(Posted 2011) [#7]
I don't know about dx7 not detecting graphics modes.

In your code example, keep in mind that GfXModeDepth() returns either 16 or 32 (and maybe 24?). It is not the same as GfxModeWidth() which is the pixel width of the screen.

I don't think you need to worry about depth really. Nobody needs 16 anymore as far as I know. So when you detect a mode using depth 16 you can probably just skip it (That's what I'm doing.) You can also discard the really small modes (640 x 480 and smaller). This should allow you to present the user with less than 10 or so modes - maybe only 3 or 4 - with a toggle button for fullscreeen vs. windowed.


Axel Wheeler(Posted 2011) [#8]
I found the link I mentioned before, by filax:

http://www.blitzbasic.com/codearcs/codearcs.php?code=2459


Yue(Posted 2011) [#9]
Hello! code is great as I passed, the fundamental idea of working with 16 bits, is basically my computer, it is very bad, because if you increase dynamic shadows, special effects and stuff the fps dies and everything is very slow.

Could work well for slow but sure not run smoothly will yield something rare in end user machines.

Actually I have many limitations and I think that use 16-bit but not much insurance is something I arranged the fall of fps.

Another issue is that we need to do in real time, without restarting the game to change the resolution, we already do fairly well with EndGraphics () and so far has given me good results, being a 3D menu.

Regarding the possible error and the resolutions direcx7'm not sure, because I think having read somewhere that if there is conflict, for direcx7 only supports a maximum 1024 x 768, again not sure.


Yasha(Posted 2011) [#10]
I think having read somewhere that if there is conflict, for direcx7 only supports a maximum 1024 x 768,


DirectX7 supports a maximum of 2048 x 1536.


Yue(Posted 2011) [#11]
Yasha =). Ie I need to consider the maximum to avoid mistakes is a good point to consider you for the information.


Yue(Posted 2011) [#12]
Sitting in a corner with a paper in his hand thinking to achieve this, now the next step is to change the resolutions.

If indeed I can scan all resolutions touching address that does not pass the limit set by DirectX7, so until that time comes to scanning.


;! Code by Yue
;! Public domain 2011 http://www.iris3d.tk

Graphics 800,600,32,False


Local Total_MG = CountGfxModes()

Local Profu_P[50]
Local Alto_P[50]
Local Ancho_P[50]


; =============================

Local T_Escape = 1 : Local Numero_MG = BuscarMG(1024,768,32)


Local X
For X = 1 To Numero_MG
	
	Alto_P[X]  = GfxModeHeight(X)
	Ancho_P[X] = GfxModeWidth(X)
	Profu_P[X] = GfxModeDepth(X)
Next 


While Not KeyHit(1)
	
	
	Cls
	Text 0,0, Alto_P[Numero_MG] + " " + Ancho_P[Numero_MG] + " " + Profu_P[Numero_MG]
	
	
	
	
	
	AppTitle Numero_MG
	
	
	If KeyHit(200) ; UP
		
		Numero_MG = Numero_MG +1
		If Numero_MG > Total_MG Numero_MG = Total_MG
		
		
	ElseIf KeyHit(208) ; Down
		
		Numero_MG = Numero_MG - 1
		
		If Numero_MG = 0 Numero_MG = 1
		
	End If 
	
	
Wend 







Function BuscarMG(Width%,Height%,Depth%)
	Local IterModes
	For IterModes=CountGfxModes3D() To 1 Step -1 
		If (GfxModeWidth(IterModes)=Width)*(GfxModeHeight(IterModes)=Height)*(GfxModeDepth(IterModes)=Depth) Then Return IterModes
		
	Next
	Return False
End Function



; ============================
End 



Yue(Posted 2011) [#13]
While in theory this is what I'm looking for my 3d menu, I can not always use the command I have to goto = (.

What touches implement is that if you go past the limit of what not to scan more direcx7 support. But that will be later.

A greeting.

;! Code by Yue v.01
;! Public domain 2011



Graphics3D 800,600,32,False
SetBuffer BackBuffer()	

Local Total_MG = CountGfxModes3D()

Local Profu_P[50]
Local Alto_P[50]
Local Ancho_P[50]


; =============================

Local T_Escape = 1 : Local Numero_MG = BuscarMG(800,600,32)


Local X
For X = 1 To Total_MG
	
	Alto_P[X]  = GfxModeHeight(X)
	Ancho_P[X] = GfxModeWidth(X)
	Profu_P[X] = GfxModeDepth(X)
Next 


.Inicio
; ============================
Local Cubo   = CreateCube()
Local Camara = CreateCamera()
Local Luz    = CreateLight()


PositionEntity Cubo,0,0,5


While Not KeyHit(1)
	
	
	
	TurnEntity Cubo,0,1,0
	
	
	
	AppTitle Numero_MG
	
	
	If KeyHit(200) ; UP
		
		Numero_MG = Numero_MG +1
		If Numero_MG > Total_MG Numero_MG = Total_MG
			
			ClearWorld
			
			Graphics3D Ancho_P[Numero_MG],Alto_P[Numero_MG],Profu_P[Numero_MG]	
			
			Goto Inicio
		
	ElseIf KeyHit(208) ; Down
		
		Numero_MG = Numero_MG - 1
		
		If Numero_MG = 0 Numero_MG = 1
			
			ClearWorld  
			
			Graphics3D Ancho_P[Numero_MG],Alto_P[Numero_MG],Profu_P[Numero_MG]
			Goto Inicio
	End If 
	RenderWorld()
	Text 0,0, Ancho_P[Numero_MG] + " " + Alto_P[Numero_MG] + " " + Profu_P[Numero_MG]	
	Flip 
	
	
Wend 







Function BuscarMG(Width%,Height%,Depth%)
	Local IterModes
	For IterModes=CountGfxModes3D() To 1 Step -1 
		If (GfxModeWidth(IterModes)=Width)*(GfxModeHeight(IterModes)=Height)*(GfxModeDepth(IterModes)=Depth) Then Return IterModes
		
	Next
	Return False
End Function


; ============================
End