Drawing A Rectangle In SlimDX

Started by
6 comments, last by Starnick 10 years, 11 months ago

Hi, After tutorial 3 of SlimDX main website I am confused on index buffers. Can anyone write me some c#/Slimdx code on how to draw a rectangle using vertex and index buffers in slimdx so that I could practice on it further more. I'd be greatful for your kind help

Regards,

Rayyan Tahir

Advertisement
Not many samples for SlimDX in particular but for the similar SharpDX 'PavelB' took the time to transliterate the RasterTek Tutorial from C++ (which in turn is quite nice). Recently someone provided additional code samples here (don't let the Italian website scare you off).

Also, SharpDX comes with Toolkit, XNA like framework, and - since you asked earlier - is currently integrating the Assimp library, too.

Now, since you haven't mentioned which API you're using, the above is all for D3D11. For D3D9 samples you will have to resort reading and converting C++.

Which of the two (SlimDX, SharpDX) is the best option for now? Because I think I'm stuck due to lack of tutorials on SlimDX.

That's a question of personal preference. But if you're just starting out, go with SharpDX: The development is ongoing, it has lot's of useful stuff beyond DX, there's a dedicated forum, and I for one like it that it's (more or less) C# source, not C++.

Thank you I'll look into it :)

I have to agree that SharpDX is the better choice. Namely because SlimDX is a C# wrapper library that links to the C++ built DirectX libraries and SharpDX is actually a rebuild of the DirectX libraries in Managed C# code (See the SharpDX website for better explanation). Both the SlimDX and SharpDX projects are lead by the same developer, and as such SharpDX gets all of the attention now while SlimDX I believe has been all but completely abandoned. Also from my understanding SlimDX is for Direct X 9 or 10 only and does not support Direct X 11 (I could be wrong on that one). AFAIK Tutorials for both are still lacking and or non existent, however they should be growing in popularity and hopefully we should be seeing better resources coming along soon enough. The good part of SharpDX is that is done come with quite a range of demo apps and source code that you can reverse engineer. Taking what they show you and cross referencing against Direct X C++ information can get you to the answers you are looking for in most cases. If you take this approach do be sure that you have a firm grasp on programming basics, theory and the core differences between C++ and C#.

Dan Mayor

Professional Programmer & Hobbyist Game Developer

Seeking team for indie development opportunities, see my classifieds post

PS: As for your particular problem: Working from the triangle sample, I'd consider this an exercise wink.png. A (filled) rectangle is just two triangles. A rectangle outline could be achieved with triangles, too, but also look into the PrimitiveTopology.LineList or LineStrip. Just play around with the stuff.

I have to agree that SharpDX is the better choice. Namely because SlimDX is a C# wrapper library that links to the C++ built DirectX libraries and SharpDX is actually a rebuild of the DirectX libraries in Managed C# code (See the SharpDX website for better explanation). Both the SlimDX and SharpDX projects are lead by the same developer, and as such SharpDX gets all of the attention now while SlimDX I believe has been all but completely abandoned. Also from my understanding SlimDX is for Direct X 9 or 10 only and does not support Direct X 11 (I could be wrong on that one). AFAIK Tutorials for both are still lacking and or non existent, however they should be growing in popularity and hopefully we should be seeing better resources coming along soon enough. The good part of SharpDX is that is done come with quite a range of demo apps and source code that you can reverse engineer. Taking what they show you and cross referencing against Direct X C++ information can get you to the answers you are looking for in most cases. If you take this approach do be sure that you have a firm grasp on programming basics, theory and the core differences between C++ and C#.

Hmm, no different guys, although the SharpDX guy did pitch some of the ideas behind SharpDX to the SlimDX devs. Also, SlimDX supported D3D11 fully, It's the "Windows Store"/Win8 (and D3D 11.1) they didn't have any interest in supporting.

To the OP, like Dan said, the D3D API exposed in SharpDX is practically 1 to 1, so if you haven't MSDN is usually a good go-by for Direct3D documentation and programming references :)

This topic is closed to new replies.

Advertisement