| All posts |
The change to DirectX10 that never happenedpublished on 10/20/2013 7:20 PMBack in 2011 I started to convert the visualizer to be DirectX10 only. During that time I also started on a blog post as to the reason why I wanted to make this switch since I figured the question would be raised. However in the end this conversion never happened. The reasons that I remember of why this change never happened where
- In Cg DX10 there is a bug where if you try to assign a texture to a sampler that isn't actually used in the shader Cg will crash.
- cgValidateTechnique must be run on a shader before using it. Otherwise we get strange crashes like trying to set a textureparameter and it crashes with access to memory 0x000040
- Cg doesn't seem to clear the texture resource if we use one. So if we use a render to texture DX10 will warn that its still bound when we set the new rendertarget
- During that time, and still, Microsoft has stated that there will never be a DirectX 12. There has however been new 11.x releases since.
- WebGL started to make it's entrance and it's based on OpenGL and GLSL
- DirectX is platform specific
I still however think the points below are true so thought I post this for anyone that trying to figure out what API to use.
The original, slightly updated, post follows
According to the statistics I have so are only 20% of the users using XP. The rest have DirectX10 already since it comes with Vista and Windows 7 out of the box.
- Latest gfx card drivers must be installed to get any hardware accelerated form of OpenGL support at all while Vista & Win7 comes by default with DirectX10 drivers. So for most users using DirectX 10 will just work.
- Its not uncommon for the OpenGL drivers that do exists to not work correctly
- The programming interface for OpenGL isn't the easiest to work with since it was created many years ago and no real cleanup has been made. (OpenGL 3.1 has done some but I can't require it)
- Documentation for OpenGL is lacking
- There are numerous ways to do the same thing. For example rending a triangle. It all started with glVertext then they added another way and another and another. Finding out to correct way that works on all/most graphics cards is very difficult
- Even the need for a page like common opengl mistakes is bad. Don't get me wrong. That page is worth its weight in gold and anyone doing OpenGL should read every single line. The problem is, you really shouldn't need a page like that. The API should warn you when you do stupid stuff.
- OpenGL has extensions and a lot of them. In DirectX10 "everything" just exists and if it doesn't your driver/hardware wont be defined as DirectX10 capable. It's a lot easier for me to notify a user that "no your hardware is too old" than to try to debug some strange issue that later turns out to be because some extension wasn't properly supported.
- DirectX10 has a fast software driver that I might find a use for
- Lack of good tools. The now free gDEDebugger exists and helps but its far from the NVidia line of tools for DirectX
- DirectX10 support true multimonitor across multiple graphics cards.
- DirectX10 supports multithread applications out of the box so multiple threads can safely do render calls.
- DirectX10 contains the shader compiler so you know the shader code will compile correctly. In OpenGL each driver writer is responsible for creating his own shader compiler with different problems and varying levels of error reporting.
Of course everything isn't just pretty flowers and red roses. DirectX10 is created by one provider, Microsoft, that has full control of it and can do what they want. It also only works on Windows so porting the visualizer to Mac or Linux would be much harder.
Regarding the drivers for OpenGL you might be wondering how bad that actually is. Lets put it this way. Most/All new browsers now support rendering 3d inside a webpage. From the start they all used OpenGL but later they found out that many manufacturers OpenGL drivers where so broken that they had to switch to use DirectX. So now they convert all shader code from OpenGL format to DirectX format for this very reason.