Monday, January 25, 2010

Continue on DirectX

Now I'm following the tutorials in the DirectX SDK. Since I have a WinXP on my PC, I started with DirectX9. The tutorials are generally well designed, I would like to say, for beginners. But there are some small problems in the document such as typos, etc. Reading the code may resolve these kind of problems.

However, if you want to really understand how the programme works, you'd better to type the write the programme by your self instead of just open the tutorial project and compile and run it or to copy the code into your project. That is because there are quite a few details when you miss it the programme will simple not work, and the worst thing is it is hard for the beginners to know where is going wrong as you generally can not run the programme step by step as usual to find it out: you simply see the final, bad, result on the screen. For example, when I modified you code to use a zbuffer, I fogot to give an additional flag to the Clear method, as a result, I got a quite strange result on the screen, I checked my code again and again and found the problem finally. I'm not aware of any way to debug this kind of problem, please tell me if you know.

I have just completed the first four tutorials which cover the basic topics such as initialize the D3D device, render the vertices, use matrices and lights. There is one thing that I do not understand, the programme runs fine when it is visible, but it consumes 100% of CPU time whenever the client rectangle is invisble: when it is covered by another window or when the window is minimized. I'm not happy with this but I can not explain why, I'm still investigating.

Basically, D3D9 programming is quite demanding.

No comments: