Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Question about OpenGL in 2D  (Read 1557 times)

Araph

  • Bay Watcher
    • View Profile
Question about OpenGL in 2D
« on: April 25, 2011, 06:22:38 pm »

Correct me if I'm wrong, but Dwarf Fortress uses OpenGL for graphics, right? If so, could some knowledgeable programmer point me in the right direction about how to create DF style roguelike graphics? I have a big fat book on OpenGL, but it doesn't seem to say anything about 2D stuff.
Logged

Levi

  • Bay Watcher
  • Is a fish.
    • View Profile
Re: Question about OpenGL in 2D
« Reply #1 on: April 25, 2011, 06:25:15 pm »

I always assumed its just drawing textures on a 2d plane.  Maybe somebody else can correct me.
Logged
Avid Gamer | Goldfish Enthusiast | Canadian | Professional Layabout

freeformschooler

  • Bay Watcher
    • View Profile
Re: Question about OpenGL in 2D
« Reply #2 on: April 25, 2011, 07:16:21 pm »

Correct me if I'm wrong, but Dwarf Fortress uses OpenGL for graphics, right? If so, could some knowledgeable programmer point me in the right direction about how to create DF style roguelike graphics? I have a big fat book on OpenGL, but it doesn't seem to say anything about 2D stuff.

Uh... well, actually, I think that DF uses SDL for rendering/graphics. If that implements OpenGL or not, I'm not sure. I was pretty sure that SDL was mostly software rendering!
Logged

HideousBeing

  • Bay Watcher
    • View Profile
Re: Question about OpenGL in 2D
« Reply #3 on: April 25, 2011, 10:48:03 pm »

There are a lot of options. OpenGL might not be the best one because it's fairly difficult to learn compared to 2D libraries and I'm pretty sure it's mostly meant for 3D stuff. SDL is a good 2D library and ncurses can do unix terminal output if you just want ascii graphics.
Logged

Virex

  • Bay Watcher
  • Subjects interest attracted. Annalyses pending...
    • View Profile
Re: Question about OpenGL in 2D
« Reply #4 on: April 26, 2011, 08:33:26 am »

In doubt? Ask google!
For example, here's a quick introduction to get you started. Also, you can easily get OpenGL and SDL to talk to each other (or at least the bindings I'm using make it easy)
« Last Edit: April 26, 2011, 08:36:38 am by Virex »
Logged

Fayrik

  • Bay Watcher
    • View Profile
Re: Question about OpenGL in 2D
« Reply #5 on: April 26, 2011, 11:19:26 pm »

Uh... well, actually, I think that DF uses SDL for rendering/graphics. If that implements OpenGL or not, I'm not sure. I was pretty sure that SDL was mostly software rendering!
Yep. DF uses SDL. And yes, I do believe SDL uses OpenGL.

I've started to try getting SDL to work with a C# project of mine. I'm up to the point where I have an open window, ready for some sprites to go in it.
The only drawback is that SDL is compiled in 32-bit so can't be used with 64-bit applications.
Other than that, it's pretty easy to use, and I'd recommend it.
Logged
So THIS is how migrations start.
"Hey, dude, there's this crazy bastard digging in the ground for stuff. Let's go watch."

monkey

  • Bay Watcher
    • View Profile
Re: Question about OpenGL in 2D
« Reply #6 on: April 26, 2011, 11:54:23 pm »

SDL is used for window creation/event handling/input(mouse&keyboard)/textures loading/sound, etc.
opengl is used for drawing.

a simple to use lib for ascii style would be http://doryen.eptalys.net/libtcod/.

Quote
I have a big fat book on OpenGL, but it doesn't seem to say anything about 2D stuff.
2D would be drawing everything on a plane and then making sure that the plane is coplanar with the screen, you can use gluOrtho2D to set the projections for this.
Logged