OpenGL vs DirectX

Status
Not open for further replies.

alexl102

Learning... slowly!
Please could somebody help me out with a brief explanation of directX and OpenGL and which I should be aiming to use? At present, both TS12 and S&C are using OpenGL, and the diagnostics suggest some directX failures even though I'm pretty sure I have the latest version (9.0) for Windows XP.

I'm totally clueless about all of this!

Many thanks in advance,

Alex
 
Alex, I have the same problem. Im up to date on directx. I used directx for 2006 - 2010 and loved it ran a lot smoother
 
Historically OpenGL came from the Unix CAD workstation world and since it was known that it took about five years for a new standard to be agreed companies were permitted to create their own extensions. So if you wanted the best performance you often brought an nVidia graphics card as nVidia worked with game companies such as Auran to get the bet out of their video cards and in doing so ensured that they used features only available on an nVidia card. DirectX was designed by Microsoft specifically for gaming and it was designed to be vendor neutral. ATI/AMD looked at the instruction set and implemented it in silicon so suddenly AMD cards needed much less silicon to run games and thus were cheaper for a given level of game performance.

These days OpenGL still carries a lot of older instructions that aren't used for games but the nVidia directX drivers have improved substantially. In the same way AMD's OpenGL drivers have also improved.

Which is best for Trainz, it depends on the video card you have and the version of Trainz you have. The newer versions have fewer undocumented system features so try both and see which works best for you. I think N3V still set the default to OpenGl but many people find DirectX works better.

Shane has a tutorial on getting the latest DirectX version 9 whatever for Trainz, N3V don't use the latest version of DirectX by the way which is 11, although Microsoft hasn't helped you must be running Windows 8.1 to run DirectX 11.2.

Cheerio John
 
I've been wondering about this myself. I have been using OpenGL for TS12, on an NVidia GeForce 9800 GTX+ 512MB on PCIE.
In the past, I seemed to get better performance with OpenGL, but this is probably due to the NVidia card, which as Johnwhelan explained very well. I haven't tried to run TS12+SP1 in DirectX mode yet, but I think now that the subject has come up, I will try it out and see how it compares to OpenGL.
One odd thing I find is when running Google Earth (I use GE to create proto routes in Trainz). When I run it in OpenGL, I get the little red bumps at the drag points on a path (polyline), but when I run it in DirectX those little bumps aren't there, which makes it difficult to move a path once it has been drawn.

I'll do some experimentation and let you know what happens (on my system).

System specs:
Windows 7 Ultimate+SP1
MSI P67A mobo with Intel I5 2500 @ 3.3Ghz
8GB DDR3 @ 1600Mhz
BFG NVidia GeForce 9800 GTX+ 512MB & Samsung 2494HS 24" monitor
1.5TB total HDD capacity on SATA 3

CP
 
Historically NVidia has always had better Open/GL performance as well compared to ATI/AMD. This in part has to do with how much money a vendor wishes to spend on royalties and R&D. With Open/GL, I've seen odd clipping planes and other weird artifacts with ATI cards while the same scene in an NVidia equivalent is fine. Open/GL also seems to have a performance hit as well probably due to the heavy code and the backwards compatibility they have maintained in the code (sounds familiar). This too could be related to the newer video cards and their drivers too which have better DirectX performance especially if the video card being used is a gaming-level card.

John
 
Shane has a tutorial on getting the latest DirectX version 9 whatever for Trainz, N3V don't use the latest version of DirectX by the way which is 11, although Microsoft hasn't helped you must be running Windows 8.1 to run DirectX 11.2.
Cheerio John
Getting DirectX 9 is the key here ... please see Shaneturner12 tutorial
 
I've got directX 9.0 installed. There are still a few things the diagnostics claims directX fails on but I think in part my video card just isn't quite good enough, unfortunately.
 
Make sure it's the latest version (or at least the August 2009 version) - see my sticky in the General Trainz forum.

Shane
 
Would TS12+SP1 work any better with DX11 than 9? Not that my GeForce 9800 GTX+ supports it. I'm only curious to know whether someone running a cutting edge Win 8 computer would have better DX performance in TS.
Also, what effect does the amount and type of RAM you have on the video card?

CP
 
Would TS12+SP1 work any better with DX11 than 9? Not that my GeForce 9800 GTX+ supports it. I'm only curious to know whether someone running a cutting edge Win 8 computer would have better DX performance in TS.
Also, what effect does the amount and type of RAM you have on the video card?

CP

Trainz only uses Directx 9.0c calls so anything else is irrelevant. The type of RAM makes a difference basically how fast you can get information in or out of the processors so DDR5 is a lot better than DDR3 also the size of the bus normally 256 or 128 etc. In general the bigger the better but everything also has to be balanced so if the bus width isn't a bottleneck then doubling it will not improve the performance. This is a simplification but is generally true.

Cheerio John
 
Well, I'm glad I took notice of this thread. There were places on my route where I was dropping to 8 and 9 fps. It's my own fault...I have thousands upon thousands of tree splines and trees. In most places, less than 50 ft. from the track and no part of the route is bare. I thought I had taken care of the Directx update, but decided to do it again. Now in the real bad areas the fps are about 15. Still not great, but a whole lot better. I have not tried it with the openGL yet. I used to get about 30 fps at the most in my yards and populated areas. Now I have seen up to 79 fps in some areas. Thanks to Alex for bringing this topic up again, and thanks to Shane for his "tut" on the subject.

Cheers....Rick
 
I too am glad to read this thread..My experience in this is..I like too switch back and forth between Direct X vs Open GL..and the reason is, I feel as through if you do Direct X you get a better frame rate..However, I run a lot Open GL too..My trees suffer some what if I am on Direct X(Ghosty)..I really think some times you can switch Direct X and will kind of give a kick in the pants(My Theory)
 
Morning gents: Got up around midnight with a tooth ache. Feels a lot better when I am not laying down. I've been playing around looking for more fps. I'm using a GTX 260. I switched the setting from "Let the 3D application decide" to use my preference and set it to balanced. This gave me some more fps and no lose in detail that I could see. Now I'm getting lows of 18 in the heavy forest and most of the time between 20 and 30 fps.

I stopped the train in an area of heavy forest and had 24 fps with DirectX and 8 with OpenGL.

I have a couple of questions about Fraps. Why does the "counter" start off at 200 for DirectX and 60 for OpenGL? Does running Fraps have any effect on the sim's performance?

Before Trainz I used to enjoy a flight sim called CFS2. In that sim if you could keep the fps above 20 everything looked really good (no signs of stuttering, etc.). With Trains, to my eyes, it does not seem to be running perfectly until the fps are in the 40s, and even then I think there is the odd stutter.

I'm thinking fps are much better from the cab view. I rarely use this. I'm mostly in the chase view. I've invested a few bucks in rolling stock and locos and like to see what I paid for!

Cheers...Rick...I guess you can tell I'm not a high tech kind of guy!
 
Hi Rick!

If you add these to trainzoptions.txt you'll get smoother framerates:

-framerate=30 (my value, can be changed)
-framestoaverage=16

These two make the game try to lock the framerate to whatever value you choose, although it doesn't work with -vsync and its derivitives (-vsync=1, 2 or 3).

FRAPS will have some impact, especially if you have 4GB of RAM or less, at least when recording video. If you're just using it to see the framerate, then the loss in frames is negligible if there is any.

I find OpenGL runs slightly better than DirectX on my system, but OpenGL is quite unstable and the game will often crash when using it.

Kieran.
 
Thanks Kieran! I'll give it a go and experiment with it. After that, I may take a run through my endless bush. Boring? You bet! I've fallen asleep many times going through it! I could use a quick nap!

Cheers....Rick
 
Hi,

Many moons ago when I was around here in 2006-2007,this topic came up and tests were ran,pictures were taken (of the same scene,loco ect)camera did not move just to be fair.
Direct X came out on top with on aveage10-15 FPS over OpenGl that was way back then.Direct X all the way.

Daz
 
Well sir, I can see a lot of improvement! I'm trying 35 and 20 at the moment. There was one entry for 200 fps in the file, no entry for average.. not something I did. All of a sudden OpenGL IS smoother than DirectX. I'm watching the ties (sleepers?) and they are going by as smooth as silk! The Fraps counter is now the same for both, but the OpenGL looks much better. I'll continue trying different numbers. 35 and an average of 20 was the default setting on the old flight sim, if I remember correctly. By the way, I have all the sliders maxed, and don't use any fog.

Thanks again, Kieran! This really made a difference for me. I was starting to think I might have to start chopping down some trees!

Cheers...Rick
 
Last edited:
Great news!

I assume you replaced 200 with 30? That entry is included by default and it's rather sily - who needs more than 30fps?

And I assume oyu added the framestoaverage one in as well? 16 is the highest value for it.

Kieran.
 
Yes, I got rid of the 200, changed it to 35 and added the framestoaverage line below it. I will change the 20 back to 16 in the framestoaverage. In fact, I will most likely use both your figures. It's soooo much better now! Thanks for that great tip. Works great on my machine!

Cheers....Rick
 
Status
Not open for further replies.
Back
Top