Requesting conversion chart from DirectX to SlimDX:

Started by
5 comments, last by ragnarsun 14 years, 2 months ago
Just a request for a simple conversion chart. Something that could be used with current programming books using DirectX. Something that would allow the reader to glance at the chart to see what SlimDX commands, namespaces, etc. to use in place of DirectX. It should also mention which ones not to use, and anything that has changed between DirectX and SlimDX. This would make using SlimDX more of a reality for inexperienced DirectX programmers. Please note, the SlimDX help manual is not user friendly, and therefore is not up to this task. Thank you - - Deathbliss

You create reality in your mind,
Before experiencing it as reality,
So if you want to change something,
First change what you think about it.

Blog

http://adifferentpath.blog.com/

YouTube

http://www.youtube.com/user/DreamBlissFlows

Advertisement
I haven't used SlimDX very much, but in my experience most of the classes in SlimDX are just very thin wrappers around the native types. Whenever I've looked at the reference material in the docs I have no problem finding equivalents. As long as your familiar with the differences between C++ and managed languages I don't think you would have a problem translating things from a programming book.
You asked this already. Not listening to the response shows a lack of respect for the time the people took to answer your original post.
Mike Popoloski | Journal | SlimDX
The problem here is that nobody really answered my other thread, and part of the reason is I did not have a specific question. I have addressed both issues with this post.

As far as everyone saying the two languages are so similar or close to each other so as to be easily translated, well that has not been my experience. For example in this bit of code:
public void InitializeGraphics()        {            // set up a device            Direct3D.PresentParameters presentParams = new Direct3D.PresentParameters();            presentParams.Windowed   = true;            presentParams.SwapEffect = Direct3D.SwapEffect.Discard;            graphics = new Direct3D.Device( 0, Direct3D.DeviceType.Hardware, this, Direct3D.CreateFlags.SoftwareVertexProcessing, presentParams );            Direct3D.Format.                        // Setup the event handlers for the device            graphics.DeviceLost     += new EventHandler( this.InvalidateDeviceObjects );            graphics.DeviceReset    += new EventHandler( this.RestoreDeviceObjects );            graphics.Disposing      += new EventHandler( this.DeleteDeviceObjects );            graphics.DeviceResizing += new CancelEventHandler( this.EnvironmentResizing );        }


From Ron Penton's, "Beginning C# Game Programming", I get Device errors when I compile. However when I look up Device in the SlimDX help I get a huge complicated list with no clear way to translate what it says there into the appropriate terms here. Or this:

Direct3D.Device graphics        = null;DirectSound.Device sound        = null;DirectInput.Device keyboard     = null;DirectInput.Device mouse        = null;DirectInput.Device gameinput    = null;


From what I have read and posted about already, you are not supposed to use Direct Input anymore. So now you have two complications... What do you use in place of Direct Input, and how in the heck to you translate this code?

Now I posted all of this in my first post coming back here, and was told I needed to figure it out on my own. Fine. I'm not asking for the solution here, just the tools so I can quickly and easily find it. You can't build a house without a hammer, and you can't build any sort of game engine using the programming books already released without a conversion chart.

I was just trying to tackle these issues from another direction, that's all. It really is a simple request, and it would save everyone a lot of time and headache.
- Deathbliss

You create reality in your mind,
Before experiencing it as reality,
So if you want to change something,
First change what you think about it.

Blog

http://adifferentpath.blog.com/

YouTube

http://www.youtube.com/user/DreamBlissFlows

Quote:
As far as everyone saying the two languages are so similar or close to each other so as to be easily translated, well that has not been my experience. For example in this bit of code:

First, SlimDX and MDX are not languages, they are APIs. There is no "language translation" going on here -- the two code samples you've provided are both C#.

Second, this isn't a specific question. This is, basically, the exact question you posted previously, right down to the broken code sample (Direct3D.Format.).

Quote:
From Ron Penton's, "Beginning C# Game Programming", I get Device errors when I compile.

Because, as has been explained to you, Penton's book uses MDX and you're trying to use SlimDX. They are different APIs. SlimDX mirrors the native APIs more closely than MDX, so divergences like this usually occur. You were given a number of suggestions as to how you might figure out how to fix the issues, or simply rewrite the code to be correct SlimDX code, for example, by reading the native SDK documentation in conjunction with the SlimDX SDK documentation, or by taking a look at the MiniTri or SimpleTriangle samples in the SlimDX SDK.

Quote:
However when I look up Device in the SlimDX help I get a huge complicated list with no clear way to translate what it says there into the appropriate terms here.

Because there is no clear way to translate. MDX is rolling up a bunch of native API functionality into one object (The Direct3D object), whereas SlimDX leaves all of that functionality out in the open just like the native API. Which is why the native API documentation can be used to guide SlimDX usage.

Quote:
From what I have read and posted about already, you are not supposed to use Direct Input anymore. So now you have two complications... What do you use in place of Direct Input, and how in the heck to you translate this code?

This was answered as well -- you use Win32 for mouse and keyboard input, generally. This is exposed in the Windows Forms API in C#. So you consult the Windows Forms API documentation. You do not "translate" the code, you rewrite it using the appropriate API.

Quote:
I'm not asking for the solution here, just the tools so I can quickly and easily find it. You can't build a house without a hammer, and you can't build any sort of game engine using the programming books already released without a conversion chart.

You're asking for something that doesn't exist. There is no chart. It does not exist. We're not trying to be mean or vindictive and keep it from you here, it just does not exist. Furthermore, the people who know enough about all the technologies in question know that making a simple "X converts to Y" chart is impossible to do, at least in a fashion that is useful and actually helpful (as opposed to what you might believe is helpful) to the domain.

The closest you will get to such a chart is the API documentation for the technologies in question, really. Or by asking more specific questions.
I think the point you seem to miss so far is that simple mapping charts aren't going to work. Even if the mapping is nearly direct in terms of interface, there might well be underlying differences or language issues that change the way to best do things in the target language.

Furthermore, being able to read from one language, absorb what was accomplished (and why it was done a certain way), then being able to reproduce similar functionality in the target language, using its own facilities and typical idioms, is a skill that all programmers should develop.

The process is known, in the general case, as porting -- whether that be from one language to another (C++ to C#), between APIs (DirectX to SlimDX) or between Operating Systems (Windows to Linux).

Finally, the fact that you have difficulties mapping between these two -- whose differences are very slim (pun intended) -- reveals the liklihood that you do not understand what is actually going on. Copy & Paste coding, without understanding, is a dangerous enough practice when you stay within the bounds of a single language -- Applying a not-much-less naive strategy when moving between languages or APIs is going to yield inneficiencies at best, and bugs (both obvious and subtle) at worst... Now try fixing those bugs when you have neither the notion of how they were created in the first place, nor the knowlege to understand the workings of either the source or target implimentation.

If you're not comfortable divining the mapping yourself, then you need more knowlege of both the source and target domains before proceeding, or you need to be willing to develop it along the way. Shortcuts and hand-outs aren't going to help you.

throw table_exception("(? ???)? ? ???");

The only conversion chart I can imagine:


-----------------------------------------------API            Wrappers         Status-----------------------------------------------           |   MDX         |   Dead PC only           |---------------|DirectX    |   SlimDX      |   PC only           |---------------|           |   XNA         |   PC and Xbox            |               |    (with limits)---------------------------|------------------Main Lenguaje:             |---------------------------|Binary     |   Managed     |                   ---------------------------| c++       |    C#, VB     |           |---------------|           |    C#, VB     |           |---------------|           |    C#         |----------------------------


The differences is the way Wrappers are coded, for expose the directx class, the lenguaje is the same with MDX, XNA and SlimDX.

For example the XNA SetTransformation is (note how is a property):
Quote:Device.WorldMatrix = Matrix.Identity;


In SlimDX is (don't know if MDX is the same, note that are a method):
Quote:Device.SetTransformation(Enum_MatrixTransformation, Matrix)


So you need the SDK of the book you are using and the SDK of the Wrapper
that you whant to conver to.

I recomend you to post more specific question for start in SlimDX like:

Quote:
[SlimDX]How to initialize DirectX?
[SlimDX]How to Draw a Mesh in DirectX?


Sorry for my bad english.

This topic is closed to new replies.

Advertisement