Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

879229 Posts in 32971 Topics- by 24360 Members - Latest Member: meganlo34

May 23, 2013, 02:56:44 PM
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)Direct2D or OpenGL for 2D games?
Pages: [1] 2
Print
Author Topic: Direct2D or OpenGL for 2D games?  (Read 1366 times)
sigmoid
Level 0
*


View Profile
« on: June 05, 2012, 11:20:21 PM »

I'm about to start a project in C++ and I'm not really sure which to use. From what I understand, this isn't a very huge deal, which I decide to use, but I'd like someone's more informed opinion. I've already written a couple games in xna/c# but I don't know if any of the stuff I used there in Direct2D would carry over to this. Also, I plan to use box2D for physics if that matters.
Logged
Christian Knudsen
Level 10
*****



View Profile WWW Email
« Reply #1 on: June 05, 2012, 11:35:50 PM »

If you're interested in cross platform development, definitely go OpenGL.
Logged

Laserbrain Studios
Currently working on Hostile Takeover (TIGSource DevLog)
Polly
Level 2
**


View Profile
« Reply #2 on: June 06, 2012, 03:54:06 AM »

Keep in mind that Direct2D is only available on Windows 7 and Vista ( after the October 27, 2009 Platform Update ). People with Windows XP won't be able to run your game.
Logged
voxelony
Level 0
*


View Profile
« Reply #3 on: June 06, 2012, 07:41:15 AM »

opengl is probably the better solution since it is cross-platform.
BUT: 99% of the beginner-tutorials are outdated and do not teach you how to program in opengl efficently (e.g. immediate mode). they just teach you how to write bad code for a 15-year-old opengl-version. so if you want to learn programming in opengl, buy a book on version 2+ and dont read the beginner-tutorials on the internet.
but why not use a hardware-accelerated 2d engine?
Logged
mcc
Level 10
*****


glitch


View Profile WWW Email
« Reply #4 on: June 06, 2012, 11:34:44 AM »

Because raw OpenGL is not very user friendly and directx is not cross platform, I would recommend using a library built on top of OpenGL. I have heard many good things about SFML.
Logged

My projects:<br />Games: Jumpman Retro-futuristic platforming iJumpman iPhone version Drumcircle PC+smartphone music toy<br />More: RUN HELLO
kamac
Level 10
*****


Notorious posts editor


View Profile WWW Email
« Reply #5 on: June 06, 2012, 12:05:08 PM »

Quote
I have heard many good things about SFML.

I confirm Smiley

(Except that sometimes detecting text's width/height sucks, it's nice. I didn't use SFML 2.0 though, so maybe it's fixed there)

If I would have to make a choice, like you do, I would pick SFML over Allegro/SDL - But it's just personal desire.
If you really have to go with something low-level, pick OpenGL with GLEW & either GLUT/GLee/SDL.
Logged

rivon
Level 10
*****



View Profile
« Reply #6 on: June 06, 2012, 01:12:41 PM »

If you don't need scaling or rotation, then SDL (1.2) seems even better to me than SFML (I really hate the way it handles passing images around... pointers would be so much better than the references).
Logged
kamac
Level 10
*****


Notorious posts editor


View Profile WWW Email
« Reply #7 on: June 06, 2012, 01:44:02 PM »

If you don't need scaling or rotation, then SDL (1.2) seems even better to me than SFML (I really hate the way it handles passing images around... pointers would be so much better than the references).

That might be right, but like 99% of programmers needs one of these at some point.. If he doesn't need them now, he will need them later, so I guess it's better to learn something that he's going to use later on too.

I would use SDL as handling user input / window management only along with OpenGL for rendering.
Logged

Maud'Dib Atreides
Level 4
****


Obsessed with space


View Profile WWW Email
« Reply #8 on: June 06, 2012, 03:28:31 PM »

If C# is familiar to you, I totes recommend using OpenTK.
Logged

Guy: Give me all of your money.
Chap: You can't talk to me that way, I'M BRITISH!
Guy: Well, You can't talk to me that way, I'm brutish.
Chap: Somebody help me, I'm about to lose 300 pounds!
Guy: Why's that a bad thing?
Chap: I'M BRITISH.
Richard Kain
Level 10
*****



View Profile WWW Email
« Reply #9 on: June 06, 2012, 06:13:14 PM »

OpenGL is probably the route you want to go. However, I can confirm that the majority of beginner tutorials for OpenGL are hopelessly out of date. Getting started using the shader pipeline for OpenGL is a massive pain in the ass, no matter what library you're using. I personally recommend SFML as well, I've had some pretty good experiences with it.
Logged
Raptor85
Level 2
**

126746725
View Profile WWW Email
« Reply #10 on: June 06, 2012, 07:03:14 PM »

Definitely OpenGL, though peronsally I'd start with learning GLES 1.1 as opposed to the "full" opengl as GLES code is valid in GL but not the other way around (Smartphones, handhelds, tablets, etc use GLES).  I say 1.1 (which is basicly stripped down GL2) as opposed to GLES 2.0 (which is basicly stripped down GL3) because at the moment 1.1 is still FAR more widely supported and for doing 2d stuff is far quicker to get up and going (1.1 supports glOrthof which allows you to in a single function set up a "ortho" projection (so you can plot things in screen space easily, which is great for 2d) and though it requires use of vertex buffers it does NOT require use of shaders, 2.0 requires shader use and for doing an ortho projection you have to write it yourself, which isn't "hard" but more work than 1.1 .

Best way to learn, pick up a copy of the "Red Book" for whichever version you learn (GLES11 would be the GL2 red book plus the differences here http://www.khronos.org/registry/gles/specs/1.1/es_cm_spec_1.1.12.pdf) and GLES2 would be GL3 with the differences here http://www.khronos.org/registry/gles/specs/2.0/es_cm_spec_2.0.24.pdf).  The GL3 route you'll want a copy of the "Orange Book" as well which covers GLSL.
Logged

cross-platform rapid development game engine
Currently running a kickstarter to fund development of Aether
rivon
Level 10
*****



View Profile
« Reply #11 on: June 07, 2012, 08:44:48 AM »

That might be right, but like 99% of programmers needs one of these at some point.. If he doesn't need them now, he will need them later, so I guess it's better to learn something that he's going to use later on too.
Well, if you're doing just pixel art games, then you absolutely don't need them. And by the time you actually are able to make a good game, switching from SDL to SFML is very easy.
Logged
Richard Kain
Level 10
*****



View Profile WWW Email
« Reply #12 on: June 07, 2012, 06:48:06 PM »

Well, if you're doing just pixel art games, then you absolutely don't need them.

I don't know, having access to hardware-supported scaling and rotations would be useful, even in pixel-art games.

And what about 2D games with higher-resolution sprites? Just because a game is 2D doesn't mean it's going to employ a pixelated style. OpenGL can still be useful, if not strictly necessary for smaller projects.
Logged
mcc
Level 10
*****


glitch


View Profile WWW Email
« Reply #13 on: June 07, 2012, 09:27:38 PM »

Having access to shaders can be very useful even with 2D, there are a LOT of ways to make pixel art + postprocessing look very attractive.

However I think you can get that without having to give up high-level abstractions, I bet you can use SFML and still have access to opengl's more powerful features when you need it.
Logged

My projects:<br />Games: Jumpman Retro-futuristic platforming iJumpman iPhone version Drumcircle PC+smartphone music toy<br />More: RUN HELLO
Noah!
Level 6
*



View Profile WWW
« Reply #14 on: June 07, 2012, 09:58:40 PM »

Having access to shaders can be very useful even with 2D, there are a LOT of ways to make pixel art + postprocessing look very attractive.

However I think you can get that without having to give up high-level abstractions, I bet you can use SFML and still have access to opengl's more powerful features when you need it.

Even though I haven't played too much with it, yeah, SFML allows you to do whatever OpenGL stuff you want on the side. The only thing you need to do is take some precaution to not muck up its internal states, but after that you can do whatever.

Also, SFML 2.0 provides an easy way in-API to load GLSL shaders to do all that snazzy stuff.

It's a nice library. I like it. Plus 2.0 just came out and it's better than ever.
Logged

Pages: [1] 2
Print
Jump to:  

Theme orange-lt created by panic