Choice for sprite rendering in DirectX 11 using SlimDX

Started by
3 comments, last by 21st Century Moose 11 years, 9 months ago
I'm at a key choice point in my basic game framework program in C# using SlimDX and DirectX11.

Having learnt how to create basic geometry, render this to screen and apply textures, I'm now seeking to move on to sprites.

Basically I want to create a simple 2D game. I have a number of ways to go though.

1. I presume that I absolutely must create sprite objects to make a game right? At the moment I can render simple geometry and apply textures, which appear as sprites on the screen, but of course they are not.

2. I've read that support for sprites in DX11 is poor, mainly from this guy: http://nicoschertler.wordpress.com/ . Has anyone used this? Would this be a good bet to start with?

3. I have considered porting C++ code from http://www.amazon.co.uk/gp/product/1435458958/ref=s9_simh_gw_p14_d0_i3?pf_rd_m=A3P5ROKL5A1OLE&pf_rd_s=center-2&pf_rd_r=02NETAR9NS8Q6E1V2PBA&pf_rd_t=101&pf_rd_p=317828027&pf_rd_i=468294 . However, I'm not sure how efficient this would be since I'm already using Slim DX.

4. I have considered coding sprites from scratch using SlimDX and just having a go. But if someone has already written something to help (see 2), should I use this instead? I am looking to learn as well as actually produce results. I'm probably about 75% learning oriented.

Any choice I make needs to be considered carefully, so I thought I'd put this question out there before starting. I'm currently leaning towards option 2, since it looks like I'd get results quicker. I'm not terribly comfortable with a lot of work being done for me already but in the absence of any DX11 tutorials on sprites other than the C++ example in this book, I'm not sure I've got a lot of choice.

Thanks in advance.
Advertisement
Ok so I've done some more research and have noted that there is a serious issue with DX11 and 2D graphics in that Microsoft have not catered for it. There seem to be a few ways to get around this as per http://www.gamedev.net/topic/604514-slimdxd3d11-direct2d-interop/

Had I known this perhaps I couldn't have started using DX11 in the first place.

Apparently DX10 does not suffer from this problem, so I could start using that. Seems a bit of a cop out though.

Tell you what, if I have rendered a quad and applied a texture to it I can just go ahead and make a simple game like Snake quite easily right? If I can draw a single segment of a snake to the screen that's part way there and I'd just have to work on the rest of the game framework such as splitting the screen into a grid in which the snake can move around etc.
Drawing sprites using textured quads is a perfectly good solution. D3D11 doesn't include this support natively, but it's relatively simple to add on yourself.

The link you gave refers to Direct2D, a separate library for drawing vector graphics. It's not widely used, precisely because it does not play well with D3D11. I wouldn't worry about it; D2D isn't necessarily well suited for games anyway.
Mike Popoloski | Journal | SlimDX
Thanks Mike - I'm pressing on with textured quads instead of the sprites DX11 mine-field. The author of SpriteTextRenderer?, Nico Schertler, said the same thing. I suspect I'll look into using his library for when I'm ready to add text, but for graphics it seems as though I've got what I need.
Sprites in other versions of D3D are nothing more than a wrapper around textured quads, so that approach is perfectly fine.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

This topic is closed to new replies.

Advertisement