leezer3 / OpenBVE

OpenBVE- A free train simulator
http://www.openbve-project.net
280 stars 52 forks source link

Updated Build for Ubuntu & Further Development #38

Closed JonnyTech closed 3 years ago

JonnyTech commented 8 years ago

Continued from Updated Build for Ubuntu & Further Development from @sladen's repo:

Daily auto-generated builds available from here as of now- http://vps.bvecornwall.co.uk/OpenBVE/Builds/

On my son's computer (running Linux Mint 17.3 with Nvidia graphics - I think it's the nvidia-304 branch), OpenBVE-2016-03-07.tar.gz does not run correctly in full screen mode. I get a small windows top left of the screen with graphics, the other 70% of the screen is black. Trying to exit full-screen generates an error message which I shall post when I can get to his to his system. Windowed mode is working well.

Are there any logs that may be useful to you?

leezer3 commented 8 years ago

Don't think I've changed anything that should break fullscreen mode recently.... It's working on Windows at the moment. You might try installing (Or conversely uninstalling) SDL2, but that's a sticking plaster, not the solution to the issue.

Under the UserData\Settings folder, it ought to have produced a file named something like OpenBVE Crash- 2016.3.08[12:59].log Hopefully that will give a better idea of what's going on.

If not, the error message text may be of help.

Edit: Sorry, which DE/ WM are you running?

I know fullscreen may be a little broken with XFCE (They have a bug with fullscreen SDL2 windows), but I don't recognise this as the same symptons.

JonnyTech commented 8 years ago

It's running Linux Mint 17.3 64bit with Cinnamon. Previous OpenBVE's were working fine. I won't be at his computer for many hours yet but I'll do further tests then. (He's the train fan, I'm his Linux tech support!).

It works well for me, I'm running Debian Jessie Cinnamon with an Intel graphics card, I am guessing that it is an Nvidia issue but I'll report back later.

I am more than happy to do any further Linux/Ubuntu tests as required to keep the project going.

leezer3 commented 8 years ago

To note, there are a few potentially relevant changes in the most recent build for today. Whether they help or not, they should make the build a little more stable.

JonnyTech commented 8 years ago

OK, tried removing SDL, no change, reinstalled it again, still the same.

The message is: "An error occured whilst attempting to switch to fullscreen mode. Please check your fullscreen resolution settings."

screenshot from 2016-03-08 21 07 01

screenshot from 2016-03-08 21 07 08

The strange thing is that the screenshot is 640x480 but the desktop resolution is 1920x1080.

I have to force kill mono then to get my full desktop back I do: xrandr --output eDP1 --mode 1920x1080

There are no crash logs in the settings folder but I have attached the general log. log.txt

Next I'll try removing the Nvidia driver...

JakubVanek commented 8 years ago

Do you run the game in Wine? EDIT: What fullscreen resolution is configured in settings?

JonnyTech commented 8 years ago

Nope, mono - I think that Wine did not like the exe.

leezer3 commented 8 years ago

Any chance of you trying the most recent daily build? http://vps.bvecornwall.co.uk/OpenBVE/Builds/OpenBVE-2016-03-08.tar.gz

I've changed that section of code ( https://github.com/leezer3/OpenBVE/commit/c65b8724adabf5163156ceeede10f06d6d355f21 ), and the error prompt should now display the resolution it's trying to use, and the code there is in general a little more sane.

I'll have to add the screen resolution to the general log as well if we come up with more funky errors like this one.....

Also looks like there may well be a path-related bug hiding in the signal glow texture load too, but that's not majorly important just at the minute.....

JonnyTech commented 8 years ago

The tests today were with the 160308 build - I tried both with same results.

Removing the Nvidia driver and dropping to Nouveau works! So it's something specific to the driver.

Not worried about textures (for now!), just thought you might like that log.

Sorry, missed your edit: my fullscreen resolution is 1920x1090, did try others too.

leezer3 commented 8 years ago

Hmm, best answer there I can give you is that I don't have any good ideas at present. Have you tried at something like 640x480 32-bit color, with no AA or AF? (The theory being that this should be supported by anything )

It feels like the driver is presenting something to OpenTK which it doesn't actually support, but I can't give you a good answer just at the minute. If it works on Noveau, then there's probably not much I can do unless we figure out exactly what is causing it.

Edit: A note on version numbers- The version number generation system still isn't right. I'm trying not to commit changes to the version number at the minute, as this is causing merge conflicts with other people, but this looks to be causing it's own set of confusions.....

The auto-build system only keeps the most recent build for the day, which was generated at 19:07 GMT

JonnyTech commented 8 years ago

OK, I reinstalled the Nvidia driver and today's latest build.

Starting openBVE in fullscreen mode still displays the 640x480 top left corner of the screen and the rest of the 1920x1080 is black.

Start terminal window and force the resolution back: xrandr --output eDP1 --mode 1920x1080

Hooray - fullscreen mode!

leezer3 commented 8 years ago

Scratches head.... That stinks of a Nvidia driver bug when changing resolution, but whether it's OpenTK specific, or something more fundamental wrong I don't know.

I'll try and get a Nvidia box and see what I can reproduce, but no promises.

JonnyTech commented 8 years ago

I want to try the opentk resolution test from https://github.com/mono/opentk/blob/master/Source/Examples/OpenTK/Test/TestResolutionChanges.cs How to compile on Linux - can you give me a quick 101? (I am a hobby coder, just never with dotnet before)

JakubVanek commented 8 years ago
xbuild opentk-repo/opentk/Source/Examples/OpenTK.Examples.csproj

(not tested)

--- or ---

just download the TestResolutionChanges.cs and comment out the right line like this:

//    [Example("Test Resolution Changes", ExampleCategory.OpenTK, "Test", Documentation="TestResolutionChanges")]

Then copy OpenTK.dll and OpenTK.dll.config from openBVE directory to directory with the source and run

mcs TestResolutionChanges.cs -r:OpenTK.dll -r:System.Windows.Forms.dll
mono TestResolutionChanges.exe
leezer3 commented 8 years ago

ResolutionTest.zip

Built version.

For each screen (Max of 6), it should popup a dialog showing the current resolution, and the number of supported resolutions. It'll then change the screen to 640x480 and restore it.

Not too helpful, but if it seems to work, I'll cook up a basic OpenGL test (Itinerate through common fullscreen resolutions and display a triangle or something....) which reports errors too.

Note: If you use the xbuild script, you'll need to run it through the Examples.exe launcher.

JonnyTech commented 8 years ago

I did build the exe as per @JakubVanek's instructions (comment line then run mcs). On my machine (Debian - openBVE works ok), I get a popup:

Primary: {X=0,Y=0,Width=1920,Height=1080} (15 modes available)

It appears 3 times (message>ok, message>ok, message>ok) then ends. No resolution change happens - I even tried running as root.

Later when I get home I shall also try it on my son's computer.

JonnyTech commented 8 years ago

OK, I just tried starting openBVE on my computer and setting the fullscreen resolution to something other than my current desktop size, ie 1074x768. This is the result:

mono ./OpenBve.exe Unhandled Exception: System.NotImplementedException: The requested feature is not implemented. at System.Diagnostics.Debugger.Launch () [0x00000] in :0 at OpenBve.Program.Main (System.String[] args) [0x00000] in :0 [ERROR] FATAL UNHANDLED EXCEPTION: System.NotImplementedException: The requested feature is not implemented. at System.Diagnostics.Debugger.Launch () [0x00000] in :0 at OpenBve.Program.Main (System.String[] args) [0x00000] in :0 AL lib: (EE) alc_cleanup: 1 device not closed

Changing the fullscreen size back to 1920x1080, which is my current size, works.

Maybe screen resolution changes are not happening correctly at all...

JakubVanek commented 8 years ago

No resolution change happens - I even tried running as root.

I confirm this, I thought this is just something strange with my machine...

leezer3 commented 8 years ago

Any chance of trying Nouveau please?

Full-screen switching seems to work OK on a Ubuntu VM here, and if the OpenTK test app doesn't switch resolutions correctly, the Nvidia driver smell gets even worse!

Edit: Default Unity WM, will try Gnome, XFCE etc. in a bit.

JakubVanek commented 8 years ago

I have an Intel card and openBVE resolution switching works, but this demo somehow doesn't. PC: Lenovo ThinkPad X200 OS: Xubuntu 14.04 Kernel: Ubuntu stock 3.13.0-79-generic 00:02.0 VGA compatible controller: Intel Corporation Mobile 4 Series Chipset Integrated Graphics Controller (rev 07) driver=i915

JakubVanek commented 8 years ago

This is the problem:

$ mono ListResolutions.exe 
Primary: {X=0,Y=0,Width=1280,Height=800} (6 modes available)
{X=0,Y=0,Width=1280,Height=800}x32@59Hz
{X=0,Y=0,Width=1280,Height=800}x32@50Hz
{X=0,Y=0,Width=1024,Height=768}x32@60Hz
{X=0,Y=0,Width=800,Height=600}x32@60Hz
{X=0,Y=0,Width=800,Height=600}x32@56Hz
{X=0,Y=0,Width=640,Height=480}x32@59Hz

There's no 640x480x32 with vertical refresh 60 Hz. Try this:

using System;
using OpenTK;

namespace Test
{
    public class ListResolutions
    {
        public static void Main()
        {
            foreach (DisplayDevice dev in DisplayDevice.AvailableDisplays)
            {
                Console.WriteLine(dev.ToString());
                foreach (DisplayResolution res in dev.AvailableResolutions)
                {
                    Console.WriteLine(res);
                }
            }
        }
    }
}

It uses obsolete AvailableDisplays, but it's just demo. Compile: mcs ListResolutions.cs -r:OpenTK.dll; OpenTK.dll must to be in the same directory again.

JonnyTech commented 8 years ago

This is on my Debian setup:

sudo lspci |grep -i vga 00:02.0 VGA compatible controller: Intel Corporation Haswell-ULT Integrated Graphics Controller (rev 0b) mcs ListResolutions.cs -r:OpenTK.dll ListResolutions.cs(10,57): warning CS0618: 'OpenTK.DisplayDevice.AvailableDisplays' is obsolete: 'Use GetDisplay(DisplayIndex) instead.' Compilation succeeded - 1 warning(s) mono ListResolutions.exe Primary: {X=0,Y=0,Width=1920,Height=1080} (15 modes available) {X=0,Y=0,Width=1920,Height=1080}x32@60Hz {X=0,Y=0,Width=1920,Height=1080}x32@59Hz {X=0,Y=0,Width=1920,Height=1080}x32@40Hz {X=0,Y=0,Width=1680,Height=1050}x32@59Hz {X=0,Y=0,Width=1600,Height=1024}x32@60Hz {X=0,Y=0,Width=1440,Height=900}x32@59Hz {X=0,Y=0,Width=1400,Height=1050}x32@59Hz {X=0,Y=0,Width=1360,Height=768}x32@59Hz {X=0,Y=0,Width=1280,Height=1024}x32@60Hz {X=0,Y=0,Width=1280,Height=960}x32@60Hz {X=0,Y=0,Width=1152,Height=864}x32@59Hz {X=0,Y=0,Width=1024,Height=768}x32@60Hz {X=0,Y=0,Width=800,Height=600}x32@60Hz {X=0,Y=0,Width=800,Height=600}x32@56Hz {X=0,Y=0,Width=640,Height=480}x32@59Hz

I shall try both nouveau and nvidia drivers later when home.

JakubVanek commented 8 years ago

Try the modified sample, now it should switch the mode.

// This code was written for the OpenTK library and has been released
// to the Public Domain.
// It is provided "as is" without express or implied warranty of any kind.

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Threading;

using OpenTK;

namespace Examples.Tests
{
    public class TestResolutionChanges
    {
        public static void Main()
        {
            for (int i = 0; i < 6; i++)
            {
                DisplayDevice dev = DisplayDevice.GetDisplay(DisplayIndex.First + i);
                if (dev != null)
                {
                    Trace.WriteLine(dev.ToString());
                    MessageBox.Show(dev.ToString());
                    dev.ChangeResolution(dev.SelectResolution(640, 480, 32, 0)); // HERE: 60,0f -> 0
                    Thread.Sleep(1000);
                    MessageBox.Show(dev.ToString());
                    dev.RestoreResolution();
                    Thread.Sleep(1000);
                    MessageBox.Show(dev.ToString());
                }
            }
        }
    }
}
JonnyTech commented 8 years ago

mcs TestResolutionChangesNew.cs -r:OpenTK.dll -r:System.Windows.Forms.dll mono TestResolutionChangesNew.exe

Messagebox x3:

Primary: {X=0,Y=0,Width=1920,Height=1080} (15 modes available)

No resolution change, sorry. Also tried as root again.

I even tried (640, 480, 32, 59) in the changed line.

Is there another build of opentk to test?

leezer3 commented 8 years ago

This hasn't changed recently in OpenTK, so I think you're probably stuck with Windowed mode for the minute.

Not a lot I can do off the top of my head.

leezer3 commented 8 years ago

I don't think the commit above will do anything for your case, but it makes the logical change of specifically catching any exceptions thrown when the resolution is changed....

JonnyTech commented 8 years ago

I didn't get a chance to check on the other computer last night, but I will bw able to do all of the tests tonight.

How difficult is it to build my own OpenTK dll and config files?

JonnyTech commented 8 years ago

Sorry for the delay, managed to do some tests today Using OpenBVE-2016-03-22.tar.gz Updated tp NVIDIA-Linux-x86_64-361.28

All of the above OpenTK resolution tests work

mono ListResolutions.exe Primary: {X=0,Y=0,Width=1920,Height=1080} (91 modes available) {X=0,Y=0,Width=1920,Height=1080}x24@60Hz {X=0,Y=0,Width=1920,Height=1080}x1@60Hz {X=0,Y=0,Width=1920,Height=1080}x4@60Hz {X=0,Y=0,Width=1920,Height=1080}x8@60Hz {X=0,Y=0,Width=1920,Height=1080}x15@60Hz {X=0,Y=0,Width=1920,Height=1080}x16@60Hz {X=0,Y=0,Width=1920,Height=1080}x32@60Hz {X=0,Y=0,Width=1680,Height=1050}x24@60Hz {X=0,Y=0,Width=1680,Height=1050}x1@60Hz {X=0,Y=0,Width=1680,Height=1050}x4@60Hz {X=0,Y=0,Width=1680,Height=1050}x8@60Hz {X=0,Y=0,Width=1680,Height=1050}x15@60Hz {X=0,Y=0,Width=1680,Height=1050}x16@60Hz {X=0,Y=0,Width=1680,Height=1050}x32@60Hz {X=0,Y=0,Width=1600,Height=1024}x24@60Hz {X=0,Y=0,Width=1600,Height=1024}x1@60Hz {X=0,Y=0,Width=1600,Height=1024}x4@60Hz {X=0,Y=0,Width=1600,Height=1024}x8@60Hz {X=0,Y=0,Width=1600,Height=1024}x15@60Hz {X=0,Y=0,Width=1600,Height=1024}x16@60Hz {X=0,Y=0,Width=1600,Height=1024}x32@60Hz {X=0,Y=0,Width=1400,Height=1050}x24@60Hz {X=0,Y=0,Width=1400,Height=1050}x1@60Hz {X=0,Y=0,Width=1400,Height=1050}x4@60Hz {X=0,Y=0,Width=1400,Height=1050}x8@60Hz {X=0,Y=0,Width=1400,Height=1050}x15@60Hz {X=0,Y=0,Width=1400,Height=1050}x16@60Hz {X=0,Y=0,Width=1400,Height=1050}x32@60Hz {X=0,Y=0,Width=1280,Height=1024}x24@60Hz {X=0,Y=0,Width=1280,Height=1024}x1@60Hz {X=0,Y=0,Width=1280,Height=1024}x4@60Hz {X=0,Y=0,Width=1280,Height=1024}x8@60Hz {X=0,Y=0,Width=1280,Height=1024}x15@60Hz {X=0,Y=0,Width=1280,Height=1024}x16@60Hz {X=0,Y=0,Width=1280,Height=1024}x32@60Hz {X=0,Y=0,Width=1440,Height=900}x24@60Hz {X=0,Y=0,Width=1440,Height=900}x1@60Hz {X=0,Y=0,Width=1440,Height=900}x4@60Hz {X=0,Y=0,Width=1440,Height=900}x8@60Hz {X=0,Y=0,Width=1440,Height=900}x15@60Hz {X=0,Y=0,Width=1440,Height=900}x16@60Hz {X=0,Y=0,Width=1440,Height=900}x32@60Hz {X=0,Y=0,Width=1280,Height=960}x24@60Hz {X=0,Y=0,Width=1280,Height=960}x1@60Hz {X=0,Y=0,Width=1280,Height=960}x4@60Hz {X=0,Y=0,Width=1280,Height=960}x8@60Hz {X=0,Y=0,Width=1280,Height=960}x15@60Hz {X=0,Y=0,Width=1280,Height=960}x16@60Hz {X=0,Y=0,Width=1280,Height=960}x32@60Hz {X=0,Y=0,Width=1360,Height=768}x24@60Hz {X=0,Y=0,Width=1360,Height=768}x1@60Hz {X=0,Y=0,Width=1360,Height=768}x4@60Hz {X=0,Y=0,Width=1360,Height=768}x8@60Hz {X=0,Y=0,Width=1360,Height=768}x15@60Hz {X=0,Y=0,Width=1360,Height=768}x16@60Hz {X=0,Y=0,Width=1360,Height=768}x32@60Hz {X=0,Y=0,Width=1152,Height=864}x24@60Hz {X=0,Y=0,Width=1152,Height=864}x1@60Hz {X=0,Y=0,Width=1152,Height=864}x4@60Hz {X=0,Y=0,Width=1152,Height=864}x8@60Hz {X=0,Y=0,Width=1152,Height=864}x15@60Hz {X=0,Y=0,Width=1152,Height=864}x16@60Hz {X=0,Y=0,Width=1152,Height=864}x32@60Hz {X=0,Y=0,Width=1024,Height=768}x24@60Hz {X=0,Y=0,Width=1024,Height=768}x1@60Hz {X=0,Y=0,Width=1024,Height=768}x4@60Hz {X=0,Y=0,Width=1024,Height=768}x8@60Hz {X=0,Y=0,Width=1024,Height=768}x15@60Hz {X=0,Y=0,Width=1024,Height=768}x16@60Hz {X=0,Y=0,Width=1024,Height=768}x32@60Hz {X=0,Y=0,Width=800,Height=600}x24@60Hz {X=0,Y=0,Width=800,Height=600}x1@60Hz {X=0,Y=0,Width=800,Height=600}x4@60Hz {X=0,Y=0,Width=800,Height=600}x8@60Hz {X=0,Y=0,Width=800,Height=600}x15@60Hz {X=0,Y=0,Width=800,Height=600}x16@60Hz {X=0,Y=0,Width=800,Height=600}x32@60Hz {X=0,Y=0,Width=800,Height=600}x24@56Hz {X=0,Y=0,Width=800,Height=600}x1@56Hz {X=0,Y=0,Width=800,Height=600}x4@56Hz {X=0,Y=0,Width=800,Height=600}x8@56Hz {X=0,Y=0,Width=800,Height=600}x15@56Hz {X=0,Y=0,Width=800,Height=600}x16@56Hz {X=0,Y=0,Width=800,Height=600}x32@56Hz {X=0,Y=0,Width=640,Height=480}x24@60Hz {X=0,Y=0,Width=640,Height=480}x1@60Hz {X=0,Y=0,Width=640,Height=480}x4@60Hz {X=0,Y=0,Width=640,Height=480}x8@60Hz {X=0,Y=0,Width=640,Height=480}x15@60Hz {X=0,Y=0,Width=640,Height=480}x16@60Hz {X=0,Y=0,Width=640,Height=480}x32@60Hz

In OpenBVE set fullscreen mode to 1920x1080 and windowed to 1280x720 But now neither work when clicking start in OpenBVE

An error occured whilst tring to launch in windowed mode at resolution: 1280 x 720 Please check your resolution settings.

This is from the terminal

mono OpenBve.exe Xlib: extension "GLX" missing on display ":0.0". Xlib: extension "GLX" missing on display ":0.0". Xlib: extension "GLX" missing on display ":0.0". Xlib: extension "GLX" missing on display ":0.0". Xlib: extension "GLX" missing on display ":0.0". Xlib: extension "GLX" missing on display ":0.0". Xlib: extension "GLX" missing on display ":0.0". Xlib: extension "GLX" missing on display ":0.0". Xlib: extension "GLX" missing on display ":0.0". Xlib: extension "GLX" missing on display ":0.0".

There is nothing at all in OpenBVE/UserData/Settings/

So now I cannot run OpenBVE at all, cannot use the xrandr trick

leezer3 commented 8 years ago

Something I noticed & commented on in the OpenTK bugs a few days ago: https://github.com/opentk/opentk/pull/367

We're requesting a stencil buffer (Need to check if it's actually used or whether that was an accident), whereas the resolution tester does not, so that may be something to do with your issues.

Try this copy of OpenTK.dll, in which I've applied the patch mentioned in the pull request. OpenTK.zip

Failures to launch like this aren't a crash per-se, so they aren't set to generate a crash log. If you mean the whole folder is empty, try in /user/share/games/openbve

Other thing to try, assuming you are on the most recent build (As of approx 3pm today) is to open the UserData/Settings/Options.cfg file, and try preferNativeBackend as both false and true This uses two slightly different backends (SDL2 and the native X-Windows), which will hopefully react slightly differently.

leezer3 commented 8 years ago

Also, doing a little searching about: Xlib: extension "GLX" missing on display ":0.0".

This suggests that your Nvidia drivers are now in a complete messed up state. I don't know why proprietary lumps cause issues, but this is starting to remind me of the last time I tried to use fglrx....

First, try glxgears from a terminal. I strongly suspect this isn't going to work either....

If so, I think you'll need to completely purge the Nvidia drivers and start again as follows: Install nouveau Switch to nouveau and reboot. Use apt-get purge to remove the Nvidia drivers. Reboot (Again, but they hang around in DKMS if you're not careful) Reinstall Nvidia drivers.

JonnyTech commented 8 years ago

Nouveau works fine, but it's slow and glitchy - looks like I'm gonna have fun playing with NVidia drivers tomorrow - I'll get back to you soon...