8 Replies - 813 Views - Last Post: 25 September 2012 - 01:31 AM Rate Topic: -----

#1 rout3reset  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 9
  • Joined: 09-May 12

Getting started in custom rendering

Posted 24 September 2012 - 12:14 AM

I'm developing a simple 2D engine. (Or, more specifically, I'm developing several simple 2D games that I plan to piece together into an engine (though the engine is part of the end goal))

I've handled the objects, the types, the loop... But I kept coming back to the same issue. Rendering libraries are terrible. I don't want to mess with a third dimension. I don't want to run all of my code through a premade loop, and frankly, I don't care how much time it takes. I want to make my own rendering device.

I don't care if its software renderer, low level GPU passes, anything. I just want something to allow me control of every pixel on screen, so that I can finally handle this the way I want to. And frankly, after 6 hours of googling, I'm letting the answers come to me.


I'd love to write it myself, again. (I don't want any libraries) I just want a general idea of where to look next.

Appended: The engine so far has been written in C#, but seeing as libraries have failed me, I'm planning a full conversion to C++.

Is This A Good Question/Topic? 0
  • +

Replies To: Getting started in custom rendering

#2 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1004
  • View blog
  • Posts: 3,562
  • Joined: 05-June 09

Re: Getting started in custom rendering

Posted 24 September 2012 - 01:41 AM

What's wrong with Direct2D/DirectDraw for this?

It's not a library per-se as much as it is an interface to your graphics card.
Was This Post Helpful? 1
  • +
  • -

#3 BBeck  Icon User is offline

  • Here to help.
  • member icon


Reputation: 592
  • View blog
  • Posts: 1,322
  • Joined: 24-April 12

Re: Getting started in custom rendering

Posted 24 September 2012 - 07:19 AM

I think Rudi's got the right idea there.

But if you're using C#, then hopefully you're using XNA (because you are just making things overly difficult for yourself if you're not).

Honestly, I haven't hardly done any 2D in XNA, it's all been 3D for me, although I'm getting into custom rendering in HLSL for 3D myself right now.

But that being said, it seems to me that XNA makes working in 2D pretty simple. It's mostly just drawing sprites. I think if you really want to get fancy, you end up using HLSL to write pixel shaders (not vertex shaders). (I ended up using a HLSL shader the other day that had a pixel shader and no vertex shader). Honestly, I haven't tried to do any thing fancy with 2D other processing render targets.

But I would imagine there's "something" out there on special effects and whatnot in 2D XNA.
Was This Post Helpful? 0
  • +
  • -

#4 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: 1
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: Getting started in custom rendering

Posted 24 September 2012 - 09:32 AM

View PostBBeck, on 24 September 2012 - 03:19 PM, said:

But if you're using C#, then hopefully you're using XNA (because you are just making things overly difficult for yourself if you're not).

Should we still be always pushing the use of XNA, since Microsoft is kicking it out the door?

This post has been edited by ButchDean: 24 September 2012 - 09:33 AM

Was This Post Helpful? 0
  • +
  • -

#5 rout3reset  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 9
  • Joined: 09-May 12

Re: Getting started in custom rendering

Posted 24 September 2012 - 10:12 AM

View PostRudiVisser, on 24 September 2012 - 01:41 AM, said:

What's wrong with Direct2D/DirectDraw for this?

It's not a library per-se as much as it is an interface to your graphics card.


I'll look into it, but anymore, I'd like to see about really taking the time to do these things myself. But again, I will give it a try.

View PostBBeck, on 24 September 2012 - 07:19 AM, said:

I think Rudi's got the right idea there.

But if you're using C#, then hopefully you're using XNA (because you are just making things overly difficult for yourself if you're not).

Honestly, I haven't hardly done any 2D in XNA, it's all been 3D for me, although I'm getting into custom rendering in HLSL for 3D myself right now.

But that being said, it seems to me that XNA makes working in 2D pretty simple. It's mostly just drawing sprites. I think if you really want to get fancy, you end up using HLSL to write pixel shaders (not vertex shaders). (I ended up using a HLSL shader the other day that had a pixel shader and no vertex shader). Honestly, I haven't tried to do any thing fancy with 2D other processing render targets.

But I would imagine there's "something" out there on special effects and whatnot in 2D XNA.


I'm dropping C# for C++ on this project. The original intention was to make something really simple in C# just to keep myself busy, but the project has built up a bit since then. And, yes, while XNA is quite easy to use, I didn't want to have to include their redist in every project. I feel it gives a quite unprofessional feel, having an external package installed. Where potential consumers could relay the idea "Why isn't it all together?"

View PostButchDean, on 24 September 2012 - 09:32 AM, said:

View PostBBeck, on 24 September 2012 - 03:19 PM, said:

But if you're using C#, then hopefully you're using XNA (because you are just making things overly difficult for yourself if you're not).

Should we still be always pushing the use of XNA, since Microsoft is kicking it out the door?


Are they really? So soon?
Was This Post Helpful? 0
  • +
  • -

#6 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1004
  • View blog
  • Posts: 3,562
  • Joined: 05-June 09

Re: Getting started in custom rendering

Posted 24 September 2012 - 10:21 AM

View Postrout3reset, on 24 September 2012 - 06:12 PM, said:

View PostRudiVisser, on 24 September 2012 - 01:41 AM, said:

What's wrong with Direct2D/DirectDraw for this?

It's not a library per-se as much as it is an interface to your graphics card.


I'll look into it, but anymore, I'd like to see about really taking the time to do these things myself. But again, I will give it a try.

Do what yourself? Writing an abstracted interface to support every graphics card under the sun? There is literally no point and that's why so few people attempt/would do it, hence there's only really OpenGL/DirectX (and possibly some crap that Apple wrote) as the main competitors in the market.

You'll want to be writing something like SDL, which sits on top of OpenGL, but for Direct2D.

This post has been edited by RudiVisser: 24 September 2012 - 10:32 AM

Was This Post Helpful? 1
  • +
  • -

#7 BBeck  Icon User is offline

  • Here to help.
  • member icon


Reputation: 592
  • View blog
  • Posts: 1,322
  • Joined: 24-April 12

Re: Getting started in custom rendering

Posted 24 September 2012 - 10:41 AM

View PostButchDean, on 24 September 2012 - 10:32 AM, said:

Should we still be always pushing the use of XNA, since Microsoft is kicking it out the door?


Butch, you make an excelent point.

For anyone here who doesn't know, the whole XNA community is "in the dark" about what the future of C# and .Net game programming is in the near future, let alone the far future. Windows 8 is to be released next month. And a new version of Visual Studio is near as well. And yet Microsoft is ominously quite about the future of XNA and really the future of game programming in Dot Net. XNA is primarily a wrapper for DirectX to be used in .Net, but it also provides a lot of basic functionality that isn't part of DirectX - as far as I'm aware - such us basic collision detection (it supports AABBs, rays, planes, spheres). XNA has also been geared towards beginners where C++/DirectX has pretty much made it a point to push beginners away.

I'm continuing to focus on XNA, until the path forward becomes more clear (hopefully next month when Windows 8 comes out). That's because

A) I believe it's still the best learning environment to get started in (especially for 3D), and I'm trying to teach people.

B) It will still run on Windows 8 even if there's no future version of XNA and it runs as a legacy program in Windows 8's Windows7 desktop app. So, all the XNA 3.0 and 4.0 books and tutorials still provide the best learning environment in Windows 8 even if you won't be able to make commercial games with it. And don't forget that it may take another year for people to buy Windows 8. Just because they release it next month doesn't mean that everyone is immediately going to upgrade this year.

C) And the biggest reason for me is that XNA provides the best learning environment and I need to soak up all the knowledge I can before I go back to C++ where there is little in the way of help. For example, I've spent the last month trying to figure out pre-rendered lighting (handling a large number of point lights) in XNA (really it's a High Level Shader Language thing but I'm doing it XNA). I've read several C++/DirectX text books to learn as much as I can about not only HLSL but this specific problem. In the end after Googling and buying hundreds of dollars of the big computer graphics books (all C++ and math, none XNA), the only example or explination of how to do it was in an XNA 4.0 book.

There is a tremendous amount of stuff like that that isn't necessarily specific to XNA that you can learn and then take back to C++ or whatever else you're using (because it's not really language specific). The XNA books just tend to be written for more of a beginner audience and tend to make complex topics more clear than you would find in C++. In fact, in C++ you spend so much time dealing with the basics that 1,000 page C++ game programming book tends to cover about what you would find in a 100 page XNA book. I own quite a few of both.

Anyway, to sum it up: the future of game programming in C# is looking pretty dim. In fact, the whole near future of learning game programming is starting to look pretty dim because Microsoft "seems" to be suggesting that from now on they will support 2D game programmers in HTML5 (or whatever comes after that) and 3D game programming in C++, but will no longer encourage people to learn 3D games programming and they can either "magically" learn it (or already know how to do it because they've been doing it for years) or not do it at all. So, unless Microsoft changes their tune as Windows 8 is introduced, it seems to me that now is the time to learn XNA (and all the advanced game programming you can) before XNA is completly gone and you're left fending for yourself in a rather rough environment.

But I certainly agree that I wouldn't be pursuing XNA to make a commercial game at this point, until Microsoft makes it clear that there is a path forward for commercial game programming in .Net, but for me XNA is about learning and not about selling commercial products.

This post has been edited by BBeck: 25 September 2012 - 08:29 AM

Was This Post Helpful? 0
  • +
  • -

#8 rout3reset  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 9
  • Joined: 09-May 12

Re: Getting started in custom rendering

Posted 24 September 2012 - 03:33 PM

View PostRudiVisser, on 24 September 2012 - 10:21 AM, said:

View Postrout3reset, on 24 September 2012 - 06:12 PM, said:

View PostRudiVisser, on 24 September 2012 - 01:41 AM, said:

What's wrong with Direct2D/DirectDraw for this?

It's not a library per-se as much as it is an interface to your graphics card.


I'll look into it, but anymore, I'd like to see about really taking the time to do these things myself. But again, I will give it a try.

Do what yourself? Writing an abstracted interface to support every graphics card under the sun? There is literally no point and that's why so few people attempt/would do it, hence there's only really OpenGL/DirectX (and possibly some crap that Apple wrote) as the main competitors in the market.

You'll want to be writing something like SDL, which sits on top of OpenGL, but for Direct2D.


Yes, there is a point. An no, I wouldn't by far write it for everything. But to touch on some larger cards (such as the HD 3000 series), to learn how to do it myself. Why is that such a terrible thing?

My idea wasn't ever to cover all cards, and make some unstoppable tank of a 2D engine. I want control of my screen. But I understand what you're saying. I'm just also saying, No, I'm not afraid of such a task.
Was This Post Helpful? 0
  • +
  • -

#9 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1004
  • View blog
  • Posts: 3,562
  • Joined: 05-June 09

Re: Getting started in custom rendering

Posted 25 September 2012 - 01:31 AM

Then good luck with it and keep us updated! :)

(PS: It's a terrible thing because it's 99% useless. At this point you're not writing a 2D Engine, you'd be writing a whole rendering library which is something entirely different from an engine. Your engine would then need to sit on top of this and make all of the calls to your arbitrary library.

It would instead be better, as already mentioned, to sit on top of OpenGL or DirectDraw and make your calls to this, your engine shouldn't really even care what renderer it's plugged in to. In fact, if you're really this ambitious then start with an engine, abstracting out your rendering calls so that you can plug in pretty much any backend. Then start writing it on top of DirectDraw, when you're done, write an OpenGL driver for your abstraction layer and use that, then when you're done, start on your own renderer and plug that in. That way if you give up, your game will still work just fine :))

This post has been edited by RudiVisser: 25 September 2012 - 01:34 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1