Advertisement

2D vs 3D

Started by March 16, 2015 09:27 PM
11 comments, last by Nypyren 9 years, 9 months ago

OpenGL is always a great place to start I find, it's cross platform and is just about on par with Directx.

Honestly, if you're focusing on porting you code over to other platforms as a beginner, you're doing it wrong. I would be very surprised if anyone has made money from the first few applications they have written.

Porting should be done after you have a working application, not when you're struggling to push a mere triangle to the framebuffer. I'm not saying that you litter your source code with non-portable function calls and hacks, but you should not be going to great lengths to make your code run on 6 platforms. Stick with one, for example Windows, and learn the content. D3D has a lot better tools and documentation (and overall API structure) IMO. Remember that you can always learn the other API later on (I personally believe you should), so your initial choice does not matter as much as you think.

OpenGL is a fine choice, but be sure to include the pros of D3D as well so a beginner can make a intelligent decision.

With OpenGL you'll be able to effectively learn all the things that you need to learn such as how to create orthographic matrices and rotation/translation matrices which will be vital when starting on 3D Projects.

Using OpenGL (or any graphics API, really) will not teach you math. Sure, the API utilizes mathematics, but it will not teach you anything. Use an external source to learn the math. I recommend picking up a decent math book (the internet works fine as well). That will teach you 3D math.

The other major added bonus is that you'll be able to learn OpenGL with just about any language that you want as most of these major languages have frameworks that provide the bindings! I'm currently developing a series on Java and LWJGL 3 which is the framework that provides OpenGL bindings for Java so you should check it out: OpenGL Tutorials

You can also learn D3D more or less any language you want. Rastertek has lovely D3D tutorials, so be sure to check them out. It also has less complete modern OpenGL tutorials, but I can't comment on their quality.

Regardless of the language you choose, be sure to make sure they are modern versions of the API. That means D3D10+ (you should actually be using D3D11+), and OpenGL 3.3+.

When you first move into 3D, you should pick a concept where the art is easy. Choose something where the models can be generated programmatically, take inspiration from games like minecraft. For example in my current game, which is my first serious game in 3d after over a decade of gamedev, all the models can be constructed from 6 sided textured cubes and rectangular objects.

Take a look in my sig for examples.

It saves immense time in terms of art design.
Advertisement
2D is easier than 3D for a beginner. 3D = more state in your program. More state = more ways you can set things up wrong.

The very first problem you run into when learning how to render stuff is: "Why isn't my thing drawing?"

2D:
- It might be off-screen.
- Your alpha channel might be all zeroes.
- Your shaders (if using shaders) might be working incorrectly.
- You might have forgotten to call Draw.

3D:
- All of the above, plus:
- It might be behind the camera.
- Your view/perspective transforms might be set up incorrectly.
- You might be looking at the back of the triangle and it's getting culled.
- Your normals might be reversed.
- etc.

This topic is closed to new replies.

Advertisement