Skip to main content
GameDev.net gamedev.net
🔒 Locked

Form.Refresh (Invalidate) C# and Direct3D

Started by rm2000 May 6, 2009 at 1:05 PM 5 replies 3.5k views
Original Post
rm2000
rm2000
In the past I've used C++ to do some minimal Direct3d development and was trying my hand at using C# because of it's ease of use in getting set up. In my Form.OnPaint method I tried using this.refresh (or the slower this.invalidate) but the performance seems terrible. It will draw the form without the Direct3d objects, then being the scene, then refresh the form without the objects, then begin the next frame etc. Any ideas? Thank you.
Mike.Popoloski
Mike.Popoloski
It is not recommended that you manually invalidate the form to trigger drawing messages. Instead, hook into the Application.Idle event, as described by Tom Miller here.

Just as a side note, Managed DirectX (which it sounds like you're using) is completely dead and is no longer recommended for general use. If you're looking for an alternative, look into XNA or SlimDX.
Mike Popoloski | Journal | SlimDX
starman2049
starman2049
I am confused by the comment that Managed DirectX is completely dead. Have you seen anything from Microsoft to that end?

I have my own existing C++ cross-platform engine technology and tool chain, and am in the process of porting it over to C#. I am doing it mostly to stay current. I think that in 5 years if I tell people that my engine is C++ only than I might start to look like an old dog.

Certainly DirectX is not dead - that is a core API, which is used by both Windows and Xbox. What makes Managed DirectX "dead".

If on the other hand you are suggesting that if you are a newcomer to "Windows 3D" than you might be better off starting with XNA becasue it gives you so much for free and integrates nicely with modern managed languages like C#, than I complete understand and agree.
My Apps:Putt Nutz
feal87
feal87
Quote:
Original post by starman2049
I am confused by the comment that Managed DirectX is completely dead. Have you seen anything from Microsoft to that end?

I have my own existing C++ cross-platform engine technology and tool chain, and am in the process of porting it over to C#. I am doing it mostly to stay current. I think that in 5 years if I tell people that my engine is C++ only than I might start to look like an old dog.

Certainly DirectX is not dead - that is a core API, which is used by both Windows and Xbox. What makes Managed DirectX "dead".

If on the other hand you are suggesting that if you are a newcomer to "Windows 3D" than you might be better off starting with XNA becasue it gives you so much for free and integrates nicely with modern managed languages like C#, than I complete understand and agree.


Managed DirectX is "dead" because Microsoft discontinued it, there will be no update in the future, no DX10/11 version etc... (And in the current SDK's even the examples are removed.)
You will not have any kind of support or bug-fix from them. You can use the current functionality, just that...

As Mike pointed out, pass to XNA (if you need simplicity or Xbox support) or to SlimDX (that is a wrapper over DirectX still supported and developed)
rm2000
rm2000
All great comments, thank you. I was having a difficult time finding managed DirectX resources so it makes sense if Microsoft is phasing it out. I was going to go the XNA route, but not sure if I want to go that way or not (versus just using C++ to do what I need to do).
ucfchuck
ucfchuck
slimdx is awesome imho, ive been using it for directx with c# for almost a year now.
MJP
MJP
If you're looking at SlimDX vs XNA, keep in mind that they have different aims. SlimDX is meant to be a thin wrapper around all levels of DirectX technology, with all of the functionality being exposed to your managed code.

XNA is more of a game-development framework that happens to include a managed wrapper of Direct3D9. The wrapper is generally good enough to do 95-99% of the stuff you'd do in native D3D9, but some things are not exposed or have weird usage semantics in order to maintain compatibility with the Xbox 360. There's also other features like the Game class and the Content Pipeline that are more general-purpose tools for game development.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.