Wednesday, 6 January 2016

DirectX vs OpenGL

DirectX  vs  OpenGL







The Valve Linux Team breaks it down on their shiny new blog: With an Nvidia GTX 680, Intel i7-3930k, and 32GB of RAM, Windows 7 and DirectX, Left 4 Dead 2 maxes out at 270.6 fps. With the same hardware, but different software — Ubuntu 12.04 and OpenGL — L4D2 scores 315 fps, almost 20% faster than Windows.
These figures are remarkable, considering Valve has been refining the Source engine’s performance under Windows for almost 10 years, while the Valve Linux team has only been working on the Linux port of Source for a few months. Valve attributes the speed-up to the “underlying efficiency of the [Linux] kernel and OpenGL.”
The Linux port of L4D2 didn’t start off at 315 fps, of course — the initial version actually maxed out at just 6 fps. To realize such a huge performance gain, a three-pronged approach is taken: The game is tweaked to play nicely with the Linux kernel, the game is optimized to work with OpenGL (rather than DirectX), and bugs in the Linux graphics drivers are addressed.
This last point is interesting: Valve has long-standing relationships with AMD, Nvidia, and Intel, where Valve reports driver bugs and the GPU maker fixes them in a timely fashion. Valve is carrying this relationship over to Linux, which is very important for the continued growth of Linux as a gaming platform. In this case, Valve says that the Nvidia Linux driver lacked multithreading support — and once they added it to a later version of the driver, performance increased.
But here’s the best bit: Using these new OpenGL optimizations, the OpenGL version of L4D2 on Windows is now faster than the DirectX version. With the same hardware, Windows 7/OpenGL/L4D2 clocks in at 303.4 fps — compared to Windows 7/DirectX/L4D2 at 270.6 fps. In short: OpenGL is faster than DirectX.
DirectX logoAs for why OpenGL is faster than DirectX/Direct3D, the simple answer is that OpenGL seems to have a smoother, more efficient pipeline. At 303.4 fps, OpenGL is rendering a frame every 3.29 milliseconds; at 270.6 fps, DirectX is rendering a frame in 3.69 milliseconds. That 0.4 millisecond difference is down to how fast the DirectX pipeline can process and draw 3D data.

Why do we still use Direct3D?

If OpenGL is faster, why is DirectX still the predominant API? It isn’t because of image quality or features: OpenGL 4.0 has all of shaders and tessellators and widgets that DX has. It isn’t because of hardware support: All Nvidia and AMD graphics cards support the latest version of OpenGL along with DirectX.
Really, it all comes down to that crummy old thing we call the network effect — and, of course, monopolistic heft and marketing dollars. DirectX, because it has a cleaner API and better documentation, is easier to learn. More developers using DirectX = more DirectX games = better driver support. This is a vicious loop that again leads to more DX devs, more DX games, and better DX drivers/tools/documentation. Microsoft has relentlessly marketed DirectX, too — and who can forget the release of Windows Vista and Microsoft’s OpenGL smear campaign? Vista’s bundled version of OpenGL was completely crippled, forcing many devs to switch to DirectX.
Steam LinuxMicrosoft has good reason to hamper the progress of OpenGL, of course: While DirectX is proprietary and only runs on Windows, Xbox and Windows Phone, OpenGL is completely cross-platform. There are solid OpenGL implementations for Mac, Linux, PlayStation 3, Nintendo Wii, and just about every modern smartphone (OpenGL ES). It obviously in Microsoft’s best interests to ensure that the best gaming experiences are exclusive to its platforms.
With Gabe Newell’s distaste for Windows 8 (and Blizzard echoing his sentiments), the imminent release of Steam on Linux, and the continued growth of smartphone games, we could be on the cusp of an OpenGL revolution. If the Windows gaming crown continues to slip, OpenGL might soon become the default API, rather than an afterthought. Very soon, it might be standard to develop a game that works well across every platform — rather than focusing on Direct3D and leaving Linux and OS X out in the cold.
Valve will be speaking about its Linux/OpenGL advancements at SIGGRAPH 2012 next week. SIGGRAPH is where we usually hear about the latest OpenGL and DirectX news, too — so stay tuned!





Image result for direct x logo

Image result for opengl logo



my system:
  • Intel Core i5 2500k
  • Nvidia Geforce 770GTX
  • 16 GB RAM
  • Windows 7 (I also run Linux but OpenGL is the only option there and I haven't yet downloaded the native Linux Reborn client)
  • OpenGL (run with "-gl") - 185 FPS
  • DirectX 9 (run with no launch options) - 175 FPS
  • DirectX 11 (run with "-DX11") - 135 FPS
64 bit vs 32 bit I couldn't observe much of a difference in FPS.
So OpenGL was the fastest, DirectX 9 was a close 2nd, and DirectX 11 showed a noticeable performance hit. What I'm curious about is does DirectX 11 have any new visual effects or quality gains? I'd also be interested to know what AMD users have to say. Last I checked AMD's OpenGL performance was pretty bad. Would be interested to see if they've stepped up their game there.

Even on Warcraft III, performance on OpenGL was much better than DirectX.

Windows 7 + Nvidia 650 Ti: OpenGL is working much better in Borderless window than DX11. Stutter is completely gone and works as good or better than Dota 2 Source 1.
Also a tip for Nvidia -GL users, you can set Triple Buffering on in the nvidia control panel (this option only works with OpenGL apps) and it will use that in Dota 2 Reborn, gets rid of 60 > 30 fps drops when you have vsync enabled.
AMD users may have an equivalent option in OpenGL settings, though from what I know opengl performance isn't as good on AMD.



Properly coded OpenGL support shouldn't really look any different from DirectX. The important thing is that OpenGL support is necessary for the game to run on OS X and Linux, since DirectX is Windows-only.
Comparisons of speed between DirectX and OpenGL depend on how well the specific game is written to use each one. Sometimes a game will run slower with OpenGL since support for it was an afterthought, while sometimes a game can run faster with it thanks to extra care and effort from the developers.
One other catch about performance is that AMD doesn't support OpenGL very well. The games that make good use of OpenGL will demonstrate as much on Nvidia cards, but still often run poorly on AMD cards.
Vulkan is another upcoming alternative that isn't actually released yet. Valve has been pushing for it, so expect to see Source 2 games start supporting it around when it comes out.
Except all current Source 1 games on Linux and OS X actually run DX9, which gets translated on the fly into OpenGL calls.
Well, DirectX is Windows only, it's that there's been a lot more work done to emulate that. Wine of course has been the driving force for a lot of these developments for 10+ years. Valve decided to build (at the game engine layer, instead of above) a D3D => OGL translator for faster ports (Leave engine mostly static, fill in platform specific input interfaces, then compile native binaries).
Regardless, it aided Valve in porting all their games to multiple platforms with reasonable stability and parity. Source 2 will expand upon this, being designed from the ground up for multiple graphical APIs

_____________________________________________

Need More Detail ?   contact me !!

I sell a lot of stuff, program. knowledge, etc..  at a small cost.
I will guide you step by step, personally.
My Paypal Account is :   ksw.industries@gmail.com

Don't know how to send money ?   Click here for detail about Paypal account.
http://xyberpast.blogspot.com/2014/05/how-to-get-my-program.html

Don't have money? OK! Here is another way to get the program.
how to get my program - Free of charge





No comments:

Post a Comment