digital_fate
digital_fate

Reputation: 597

C#/.NET 3D graphics library for creating coloured cubes

I need to be able to do the following:

I'd like to use a library that has the shallowest learning curve for creating such an application, ideally something which is easy to use in the C#/.NET world.

I've looked at DirectX and some of its .NET wrappers such as SharpDX and SlimDX.

But I'm wondering if a game engine, such as MonoGame, would be easier to use for such simple requirements?

Any suggestions?

Upvotes: 1

Views: 2582

Answers (3)

T_Bacon
T_Bacon

Reputation: 404

I'd like to use a library that has the shallowest learning curve for creating such an application, ideally something which is easy to use in the C#/.NET world.

Based on the above I would go for MonoGame which implements the Microsoft XNA 4 API and should be pretty easy to pick up and go. It was designed specifically for the .NET framework and as such should be easy to pick up for someone who already programs in .NET and knows a little bit about graphics. Going for a lower level approach such as OpenGL or DirectX is likely to take more time and effort not to mention a steeper learning curve.

Upvotes: 1

elaverick
elaverick

Reputation: 312

OpenTK allows for OpenGL calls within a .NET language. It's quite well established and lends itself to porting to Mono etc. It also allows you to have (relatively) low level control of the rendering.

Alternatively if you just want C# control of rendering, how about Unity which will abstract away most of the details for you and just let you concentrate on the code (also portable to different OS's)

Upvotes: 1

Shadowed
Shadowed

Reputation: 966

You can use WPF for such things. How hard it is depends on what your 3d models are, but if you only need cubes, that shouldn't be much of a problem.
Check this link for example - https://stuff.seans.com/2008/08/13/drawing-a-cube-in-wpf/

Code is pretty much self explanatory but basically you have Viewport3D which is complete scene and then there you have defined camera (what camera "sees" is what it will be displayed) and couple of ModelVisual3D objects. First one contains light (without it, cube would be completely black) and second one is your cube.
Cube is defined by mesh and material. Mash has vertices (Positions property) and triangles. Positions are points defined by coordinates and triangles are triplets of above mentioned points. You can make other 3D shapes this way, not only cubes. Now, in most simple form, only thing you need to worry is Positions property. Changing numbers there you can change size and position of cube.
To add more cubes, you will need more ModelVisual3D objects.

Once you get familiar by manually changing these values, there shouldn't be a problem to programmatically do whatever you want.

Upvotes: 1

Related Questions