In an excerpt from the forthcoming book ShaderX2 – Introduction and Tutorials with DirectX 9, Craig Peeper and Jason Mitchell present a detailed introduction to the Microsoft DirectX High Level Shading Language, including a number of example shaders and optimization strategies.
The new OpenGL 1.5 specification also introduces a shading language… and its a industry standart, doesn’t depend on the OS, and probably will be accepted by the major players in the 3D Video board industry (read nVidia and ATI).
Hell, even the video-game consoles use OpenGL compatible video adapters!
Can anyone point me a reason to go DirectX instead of OpenGL?
DirectX does a lot more than OpenGL.
Can anyone point me a reason to go DirectX instead of OpenGL?
I see one big plus in DirectX over OpenGL – DirectX is integrated API containig sound, gfx, and input (and net but IIRC it’s not so usable if You need small pings . OpenGL is only gfx.
I agree OpenGL is good because it’s “multiplatform”, but it’s only for gfx. IMHO better to use OpenGL through SDL or Allegro so You get also other things in one API. Unfortunetly many OpenGL based projects use many different platform-specific things for sound and input, so they’re not so “multiplatform” in the end.
Also i liked DirectX API, i always thought OpenGL API is “cryptic” (less readable code), but maybe it’s because DirectX has excelent documentation (at least it was for me when i was starting coding, it was DX7 and beginning of 8 – i didn’t use it for a long time now
hmm.. also i’m not sure if anyone would try to move OpenGL (like shading language now) if there was no DirectX.
Anyway SDL & Allegro rulez! ;]
Because even if you use OpenGL you still largely have to use DirectInput and DirectSound (likely also DirectPlay while at it), might as well go for integration and use Direct3D too. And anyway, Direct3D is more featureful and Microsoft has been very quick in updating it as the need arises (much unlike the ARB, they really dragged their feet on programmability).
1) DirectX is only supported on Windows OSs and Xbox.
2) OpenGL is support on all major platforms.
Cross platform is easier if you take a few simple steps up frount:
1) Use standard graphics formats for textures, images, and icons. (.BMP, .PCX, .TIFF, .GIF, …)
2) Write all your music in a standard auto encoding. (.WAV, .MIDI, .MP3, …)
3) Place all your video clips in a standard format (.MOV, .JPG, …)
4) Use standard APIs where ever posiable. C-Library, STL, OpenGL, …
5) Make sure your IO code is seprate from your application functionality code. You want to make sure you keep the platform dependant code to as little as posiable and that code should be in it’s own source file so you can easyly rewrite it.
1) Come on, graphics files is a triviality, I can’t think of a format you could possibly use that you cannot easily access on any platform.
2) Same applies, there simply are no real wrong choices here, plus that you dont work with the files in a compressed state so you will have original raws to regenerate them from anyway.
3) Actually a bit interesting, some projects have had problems with video clips I have noticed. Mostly due to using really obscure specialized solutions though.
4) The only real point in the list.
5) Common abstraction, should be done whether you plan to port or not.
Somewhat important to note though that games are probably the least interesting application to keep portable, when you have the windows platform you have largely all the economically viable gaming market covered (bar consoles of course, but you arent going to sell many games using straight OpenGL on consoles anyway so count on a “real” port no matter what you do). This is going to be pure flamebait around here of course but it is true none the less.
Various other visualization applications are more interesting to keep portable. Which explains why OpenGL has a firm grip on applications while DirectX is extremely common for use in games.
Can anyone point me a reason to go DirectX instead of OpenGL?
Choosing an API will depend on availability of tools such as modeling, texturing and ragdoll physics will pretty much determine what API it’s going to be. Most of the tools out there use OpenGL for modeling and texturing which then later on exported to different 3D engines running on OpenGL and/or DirectX.
Bottomline, determine the tools first.
Guys,…
OpenGL and Direct3D are what you should be talking about, not OpenGL and DirectX. Also, this talk about Direct3D being more fully featured than OpenGL is so much horseshit. As for the ARB dragging their feet, OpenGL has a history of getting it right first time, unlike Direct3D which morphs with every version. For developing and maintaining code, I know which one of the two I prefer.
The odd thing about these standards (shading languages that is) is that there are more of them than there are 3D APIs. Microsoft developed HLSL for DX9 compatible hardware. ARB is developing another high level shading language. NVIDIA has developed C for graphics. The interesting thing in all of this is that the most “standard” of the three is the one that NVIDIA makes. It supports both APIs D3D and OGL and it supports all hardware (even ATI). Additionally, it was released to the public a long time before HLSL or the ARB incarnation of it. It has been around since sometime in 2002. Hopefully the implementation that the ARB decided on is compatible (or is) NVIDIA’s Cg because it is established technology that is compatible with everything (cross platform, cross api, cross hardware).
I would be interested to see how this all turns out.
Cg (NVidia’s language) and HLSL (Microsoft’s language) are actually the same language. They developed the language together; they just brand and market it differently.