Graphics Initialization

BlitzMax Forums/BlitzMax Beginners Area/Graphics Initialization

xlsior(Posted 2005) [#1]
I have a question regarding the new graphics command:

The help states the following:

Graphics (width,height,depth=16, hertz=60)

width and height specify the size, in pixels, of the graphics mode, depth specifies the bit dept and hertz specifies the refresh rate


Mostly self-explanatory, except for one thing:
does the Hertz command refer to the speed that the video adapter is preparing information, or is it the actual refreshrate that the monitor will show the refreshrate?

I have an LCD monitor myself, where refreshrates don't matter as much as on CRT's.

I find that if I specify '60' or '75' as the Hertz variable, my monitor will actually switch to those refreshrates.
But when I go to something artificially low, like say '5', the screen will update at 5 frames a second, but the refreshrate itself will stick to 60.

Now, how does Blitz handle this with -higher- refreshrates? Say, you specify 100Hz and the monitor in question won't support over 85 -- will it automatically go to 85Hz and simply try to talk to the openGL buffers 100 times a second, or will it actually try to switch to 100Hz and get an out-of-sync error?

Unfortunately that's kind of hard to test with my LCD, where any refreshrate that is not supported automatically default to 75...

But this would be something that's important to know, given how a lot of CRT's won't do 100Hz, while others make your eyes melt at 60Hz.

Also, what happens when you ommit the herz altogether? Will it default to a particular refreshrate by default, or will it assume some kind of computer-specific setting? (e.g. default refreshrate for that resolution on a particular videocard?)


flying willy(Posted 2005) [#2]
Same question here. I would hate out of sync messages and I prefer (as a vast number of people do) to have my refresh rate at 85.

A lot of monitors might only handle 75 at res x,y though!

I too would like a concrete and non-evasive answer :)


RexRhino(Posted 2005) [#3]
I was under the impression that messing with refresh rates is a bad thing, in general. That specifying a wrong refresh rate at the wrong resolution on the wrong video card / monitor can cause hardware damage.

Is there any reason not to just let BlitzMax use the default refresh?


Perturbatio(Posted 2005) [#4]
I would not force a refresh rate, use the blitz default, but find some way to offer the user the option to change it.


FlameDuck(Posted 2005) [#5]
From what I understand the refresh-rate is indicative of how long Flip waits. If it happens to be an actual setting that the monitor can display, then all the better.

Setting your refresh rate to something rediculously high, like 200 for instance, will make your game logic go at 200Hz, and your screen refresh at whatever it can muster.


Dreamora(Posted 2005) [#6]
wrong

we had a case of that in the german bb boards who set it to 200 because of his screen ...

all others just became black screens and autocrashs

let the user choose the hertz or set to 60 as notebook TFT are on 60hz!


ImaginaryHuman(Posted 2005) [#7]
The refresh rate of your monitor or lcd screen is the rate at which the video card hardware reads the contents of videoram at a given address and turns it into a picture signal that you can see. That means, at 60Hz, the physical display is redrawn to the screen hardware 60 times per second.

I am figuring that under defaul settings, the Flip command which has (by default) a syncing system active, will try to synchronize to the rate given. If you give 5Hz and your display refuses to go that low, the display may produce a minimum refresh rate such as 60Hz even though internally Blitz may have stored 5 as the refresh rate, so by using Flip with synch turned on Blitz would try to produce 5Hz updates - 5 flips per second. Even if you flip 5 times a second, the hardware still will read and display videoram at 60 times per second if that is the Hz of the display - displaying the same `frame` several times over.

If you go over the maximum Hz available I guess your hardware might (or might not - depends?) give you the maximum possible and then Flip will attempt to give you synchronization to the number you gave - which may of course produce unusual results such as frames not being seen or whatever. I don't know how they do it, but maybe that's what happens.


Hotcakes(Posted 2005) [#8]
FlameDuck and AngelDaniel are right. Primarily the hertz is the rate at which Flip returns control to your program and if Blitz decides that your monitor can handle that refresh rate, then it will use that, or pick (not the closest match, as it should be) the first refresh rate that comes up on 'the list' (presumably video driver feedback), usually 60.

So setting the hertz in BMax -is- foolproof, SO LONG AS your drivers report correct refresh rates for your monitor! The Windows 'Plug and Play' or 'Default' monitor drivers generally lean more on the conservative side so if you have them you 'should' be fine. If you have manufacturer monitor drivers which are just wrong there is nothing you or BMax can do any better.

If you use 0 to set your hertz, BMax will use your desktop's refresh rate, but then of course you will have to find helper functions to recover that refresh rate if you need to know it.


CGV(Posted 2005) [#9]
If you use 0 to set your hertz, BMax will use your desktop's refresh rate,


I haven't found this to be the case. If I set the hertz to 0 in full screen mode my monitor is switched to 60 hertz regardless of resolution, only in windowed mode does it use my desktop's refresh rate.

Can someone else confirm this behaviour or is it just my system?

I just downloaded the Windows demo today but spent several hours with it so I don't think I'm missing some detail.


klepto2(Posted 2005) [#10]
As I think this hertz is nothing than a FPS limit. So I if you set it to 20 your game will run with 20 FPS and if you set it to 500 then it try to run that FPS. So it has nothing to do with the Monitor hertz in my Opinion.