New Adventures in Direct3D 10
May 17th, 2008 | by phantom |While at Uni back in 2000 I decided that it would be a good idea to learn about this wonderful world of 3D graphics and all the cool stuff you could do. Back then it was a choice between Direct3D 8 and OpenGL; after looking about I settled on OpenGL, had a read of some NeHe tutorials and brought myself a copy of the OpenGL Programming Guide for some light bed time reading.
From that point onwards it has been pretty much OpenGL all the way, with a brief trip into D3D land when working on my final year project; a trip which didn’t work out too well.
At the time OpenGL was the best option; D3D8’s interface wasn’t great and I prefered the OpenGL way of doing things. It even had an extension system in order to allow new features to be added so you could keep up to date with hardware changes.
Then D3D9 came out, it was an improvement over D3D8 however it still wasn’t enough to drag me away from OpenGL, but as any good programmer I kept my eye on it and as previously mentioned dabbled in it briefly at the start of 2007. At this time D3D had moved forward to the Vista only D3D10. This was a large reworking of the API and required a minimal set of features from the graphics card for it to be supported; very much an all or nothing approach. Like D3D9 I took a look at D3D10, however despite having Vista I only had a D3D9 ATI graphics card and thus couldn’t learn it even if I wanted to.
On the OpenGL side of things it was announced that the board who control such things were going to work on a new version of OpenGL known as Longs Peak. It was to be a complete redesign of the API and for the first time OpenGL was going to break backwards compatiblity because the way the API currently works doesn’t reflect the best way to program the hardware. In September 2007 at SIGGRAPH the ARB talked about Longs Peak, now offically OpenGL3.0 and said they were nearly done with it and had a few issues to work out.
The OpenGL community took this news well; until the previous year the ARB had been a silent bunch giving very little away about what was going on inside it and giving us very little idea about the future of OpenGL. However in 2006 that changed and they started communicating with us more, with the announcement at SIGGRAPH that OpenGL3.0 was nearly ready everyone was willing to wait a while for this new breed of OpenGL as it was a big thing and, from the previews, looked to be a major step forward for OpenGL bringing it into the modern world and making it easier to program.
Unfortunately this is where the OpenGL story goes somewhat wrong as after SIGGRAPH it became next to impossible to extract any real information about what was going on. The best came from a post made to the OpenGL forums at the end of November 2007 saying they had found some issues and were working hard to have them ironed out as soon as. Since then it has been silence, much like the old ARB.
The community as a whole as been very vocal about this, asking what is going on and just some word, any word, from those on the ARB as to whats going on and when we can expect things to happen? The responce has been more silence and a slow disillusionment of many, myself included.
I’ve been an avid OpenGL user for some years now, I was looking forward to the new version and put any major plans on hold for it as promised of ’soon’ where thrown about. Yet, even the avid user can get sick of waiting and so I announced me intention to give up waiting on OpenGL3.0 and instead embark on a new path; learning D3D10.
The reason I went for D3D10 is because it is the future and, after looking at the API for a while, it is infact very close to what OpenGL3.0 was going to be like. The interface is a major clean up and having got hold of an D3D10 card in the last 5 months it seemed like the thing to do.
With my path set I decided to dive in at the deep end and remake my Doom3 MD5 renderer again in D3D10; this time even animating the thing on the GPU which was a step I never got around to doing.
My inital steps however didn’t go that well; while getting a window open to render in wasn’t a problem thanks to some copy and paste madeness getting something on the screen proved a slight problem
In the end the Gamedev.net forums came to my aid and I discovered that if you pass a vector of 3 components in and multiple them with a 4×4 matrix you need to supply the 4th vector element yourself or it asplodes
That problem fixed I finally managed to get something on the screen with my shaders and all was good with the world; however my MD5 model still wasn’t showing up.
This was tracked down to the maths lib I was using; it turns out it doesn’t zero initalise vector elements so I was effectively adding values to whatever garbage was in memory. With that correct something appeared on the screen at last… however it didn’t quite look right, more like someone had gone to town on this model with a baseball bat.
So, I’m currently in the process of debugging this, however it seems at least my bones are in the right location as the black lines show;
I’m sure I had this problem with my OpenGL version but I’m not sure what I did to resolve the problem which means I need to rack my brains and try to remember… it was only a few years ago I first did it, shouldn’t be too hard.. right?
Update:
Turns out I wasn’t using the maths library correctly, a quick change of code and now it works just fine
![]()
You must be logged in to post a comment.