The forum rules state that more than a handful of lines of code should be posted to a pastebin. Then you post a link to that, rather than posting a ton of code in the forum. The forum software sometimes has issues when large amounts of code are included in a post.
We'll be glad to help you, but code is hard to read in a forum post here, mainly due to the lack of useable width.
Also, your question started with a statement about DirectX 10 and Direct3D and I just ass-u-me'd that's what you were using. Had your post been less cluttered with code, I might have read the whole thing and not been stupid. ;-)
I wasn't really trying to be unfriendly and I apologize for coming off that way.