SDL And Twinview

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
User avatar
PeterNewman
Greenskin
Posts: 128
Joined: Mon Jun 21, 2004 2:34 am
Location: Victoria, Australia
Contact:

SDL And Twinview

Post by PeterNewman » Mon Jan 03, 2005 4:38 am

I'm posting a solution here, so it's gone in to "Using OGRE in practice".

If you have an nVIDIA card and are using the nVIDIA drivers with TwinView (two monitors showing up as one), you might have found that the SDL renderer would only let you choose one resolution/window size, being your entire display.

Turns out its a.. peculiarity... of the nVIDIA drivers and the way they non-standard-ly implement the TwinView.

In your xorg.conf (or whatever the other X server's user), you will have code that looks something like this:

Code: Select all

Section "Device"
    Identifier  "NVIDIA Driver"
    Driver      "nvidia"
    #VideoRam    1048576
    # Insert Clocks lines here if appropriate
    Option "TwinView"
    Option "MetaModes"                  "1280x1024,1024x768@1024x1024"
    Option "SecondMonitorHorizSync"     "30-70"
    Option "SecondMonitorVertRefresh"   "30-160"
    Option "TwinViewOrientation" "RightOf"
    Option "DPMS"
EndSection
That's copy-paste from my set up, yours may vary. Basically, the MetaModes command is the important one. It sets up a "desktop" that consists of monitor one at 1280x1024 and monitor 2 at 1024x768 (the @1024x1024 allows me to scroll that display up and down to see the remaining space, cause the desktop is square).
When you run an SDL app, it queries the X server for what resolutions are available (even if you run in windowed mode). The nVIDIA driver will only report one resolution (the size of the desktop).
The fix for this is to make your MetaModes line looks like:

Code: Select all

Option "MetaModes"                  "1280x1024,1024x768@1024x1024;1280x1024,NULL;1024x768,NULL;800x600,NULL"
This makes the nVIDIA driver return more screen modes, so SDL reports more options, which will let you make windows in those sizes. AND you can now use Ctrl-Alt-Numpad + and - to go through the list. (The desktop stays the same size, but you can scroll the "viewport").

Of course, you will have to restart your X server for these configuration changes to take effect. Usually logging out of X will do it.

Hope this help's some-one. I should probably find an SDL forum or something and post this there (I found it out while trying to fix Neverwinter Nights, which uses SDL too), but I'll give it to the OGRE community first :D
0 x

Post Reply