Sign in to follow this  
Chase Mosher

[.net] Questions about MDX 2.0, Initialization and Render Loop.

Recommended Posts

I think I remember reading somewhere Managed DirectX 2.0 isn't something you want to use as it's not going to be used for to long among other things. Am I just going crazy or is this true? I don't want to start coding something and end up having to recode it again. What is the proper way to initialize DirectX? All the tutorials I've read are all the same, it looks like one person wrote it and 100 people copied it. I don't mind if its 200+ lines of code just to initialize it, I just want it done right. I know render loops are a tough subject but I'm still searching a good render loop that isn't so highly debated. It seems like for ever person that says its a good way to do it, theres 10 people that say a differnt way is better. It's like that for every render loop so it's somewhat of a never ending cycle.

Share this post


Link to post
Share on other sites
MDX 2.0 will indeed not be released in it's current form, you should use MDX 1.1 (this was confirmed by Tom Miller, who made MDX in the first place). You can find more information on that in this thread and this one.

As for the proper way to initialize DirectX (I assume you want to know about D3D specifically), it all depends on what you want to do with it. The typical initialization goes something like this:


  1. Set up basic PresentParameters

  2. Set up CreateFlags

  3. Check support more advanced options for the PresentParameters (like multisampling) using the Caps or Manager helper classes with the appropriate create flags and set these options as desired and supported

  4. Create your device

  5. Optionally hook DeviceLost and DeviceReset events

  6. Set up any Sampler and Render states (like texture filtering and lighting)

  7. Load resources


Since you'll need a valid handle to your Form, you'll probably will want to do this initialization in an eventhandler for your Form.Load event. Other than that, I can't give you any generic advice on how to write the ultimate MDX device intialization.

I could throw all kinds of options your way on how to initialize absolutely everything, but I doubt that would really help you out in the short or long run (not to mention that it would be an insane amount of work [wink]). As said, you'll eventually have to come up with you initialization code yourself, based on what you need.

So with this in mind, I'd stick with the tutorial codes for now and try to really understand them; why things are necessary, how it works and what effect it will have on your program. You can find more information in the docs and you can always check back in here if you have a question on a specific setting.

Edited: as for the render loops, these are indeed a bit debatable, but I think it comes down to personal preference and a bit of a purists' discussion (guilty as charged [smile]). The general consensus is to use the OnIdle/AppStillIdle loop since Tom recommended that one (more info here). I wouldn't worry about it too much for now though, since you can easily plug in another loop if you should really need to at some point.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this