Thread: How do you all feel about a possible e-book on OpenGL in 2D?

  1. #1
    Software engineer
    Join Date
    Aug 2005
    Location
    Oregon
    Posts
    283

    How do you all feel about a possible e-book on OpenGL in 2D?

    I am curious if anyone would be interested in a e-book that focuses on 2D game development in OpenGL/GLUT. It would pretty much focus on primitive shapes to tile-based games, 2D collision, perhaps a few case examples of arcade games, etc. Yes, Bubba, with hardware-acceration. The reason why I thought about it is because it seems like there are no books on this subject when it comes to OpenGL. Beginners are often learning 3D first these days with it instead of learning how to build simple games like Asteroids or Pong. There are some obvious ways of learning how its done after learning 3D after a while, but a book that focused on nothing but 2D would be pretty interesting and probably less complex, meaning a focus on two demensions instead of three. In fact, I too had to learn OpenGL through 3D first and I later found a japanese website to find my information for making animation with sprites.

    If it sounds interesting, I would like to hear about any topics that you might want to see in it. If anyone has games they have done in OpenGL in 2D and would like it to be included with the book for playing and viewing your open-source code, it could also help the beginner so there are several different views and methods for doing 2D work. Opinions are definitely welcome.

  2. #2
    Registered User Frobozz's Avatar
    Join Date
    Dec 2002
    Posts
    546
    Personally I wouldn't recommend using GLUT simply because its out of date. I believe SDL would be a much better choice. Besides being up-to-date, it has other features that would aid game development - like sound support.

  3. #3
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    I wouldn't use SDL or GLUT or DXUT. Learning from scratch is just fine. Then once they understand how the underlying API works feel free to use SDL, GLUT or DXUT. By then thought they won't want to.

    I don't see much need for a 2D book, but I guess it couldn't hurt.

  4. #4
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  5. #5
    The Right Honourable psychopath's Avatar
    Join Date
    Mar 2004
    Location
    Where circles begin.
    Posts
    1,071
    If you're going to use GLUT, use FreeGLUT or OpenGLUT, since those are about a million times more up-to-date than the original GLUT.
    M.Eng Computer Engineering Candidate
    B.Sc Computer Science

    Robotics and graphics enthusiast.

  6. #6
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Quote Originally Posted by Bubba
    I wouldn't use SDL or GLUT or DXUT. Learning from scratch is just fine. Then once they understand how the underlying API works feel free to use SDL, GLUT or DXUT. By then thought they won't want to.
    All SDL provides is a cross-platform way of obtaining an OpenGL context. That's all I ever used GLUT for either. I see absolutely no reason to learn the underlying API, i.e. WGL or GLX.
    Of course you'll still have to learn OpenGL itself, but that's different.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  7. #7
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Of course you'll still have to learn OpenGL itself, but that's different.
    Which is what I said.

  8. #8
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    I know. I just wanted to point out that I don't consider OpenGL to be the "underlying API" of GLUT or SDL.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  9. #9
    Registered User Frobozz's Avatar
    Join Date
    Dec 2002
    Posts
    546
    Quote Originally Posted by Bubba
    Then once they understand how the underlying API works feel free to use SDL, GLUT or DXUT. By then thought they won't want to.
    Personally I learned GLUT and SDL before I learned the basics of the Win32 API. And I feel that SDL is a better choice. Why reinvent the wheel and also limit yourself by learning the underlying API of the platform when a library that makes life easier already exists.

  10. #10
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    You need about 50 lines of Win32 to get DX up and running and thats it. I don't see the problem.

    And besides what is a book on 2D going to explain? How to use textured quads as sprites? That is painfully obvious. How to do tiling? I don't think there is enough material to even be a book.

    Everything we used to do in 2D can be done in a 3D API with 4 vertices. That's it. Simple.

  11. #11
    Registered User Frobozz's Avatar
    Join Date
    Dec 2002
    Posts
    546
    Quote Originally Posted by Bubba
    You need about 50 lines of Win32 to get DX up and running and thats it. I don't see the problem.
    There's your problem - this book covers OpenGL. At the most, SDL might take one-third the lines that Win32 takes. Also it is far simpler.

    Code:
    if (SDL_Init(SDL_INIT_VIDEO) < 0) { return 0; }
    
    SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
    
    if (SDL_SetVideoMode(640, 480, 32, SDL_OPENGL) == 0) { return 0; }
    When you're ready to present the rendered results to the screen:

    Code:
    SDL_GL_SwapBuffers();
    Last edited by Frobozz; 09-22-2006 at 08:33 AM.

  12. #12
    Software engineer
    Join Date
    Aug 2005
    Location
    Oregon
    Posts
    283
    Hi, thanks for the responses. I will probably keep it to GLUT because it's simple and straight forward regardless of what operating system of choice. They don't need all the bells and whistles that SDL has before eventually learning Win32. I may not teach Win32 because it requires a book on its own for serious development, but I might be a little liberal and teach Win32 notes here and there for Windows developers using GLUT considering there are some very helpful functions like GetAsyncKeyState(), GetSystemMetrics(), GetSystemInfo(), etc.

    The book will be much more than tossing textures onto shapes. Some things I am considering is 3d sound in 2D environments (someone chopping wood to the left of your player), complete collision detection, isometric games, AI, physics, and user interfaces. The beauty in such a book would be a direct focus for 2D games for beginning OpenGL developers. It's definitely not a book for advanced developers, but it meets beginners where they are without having to teach pointless 3D just to get a 2D game up and going. Because of this, the reader has material that is instantly usable for their first five or so games.
    Last edited by dxfoo; 09-22-2006 at 08:54 AM.

  13. #13
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Quote Originally Posted by Bubba
    You need about 50 lines of Win32 to get DX up and running and thats it. I don't see the problem.
    It doesn't compile in Linux or MacOS. You may not consider this a problem. But in any text about OpenGL, which by itself is blessedly platform-agnostic, a more or less random dependence on a specific system IS a problem in my opinion. What's the advantage of using Win32 init code over using SDL init code? (Aside from being 10 times as long.)
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  14. #14
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    I'd say resource management is more important than all of those things you listed. Without it you have a very pretty wrapper around some very ugly code.

  15. #15
    Software engineer
    Join Date
    Aug 2005
    Location
    Oregon
    Posts
    283
    Of course.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OpenGL - 2d text in 3d game
    By mikeb1986 in forum C++ Programming
    Replies: 1
    Last Post: 03-22-2006, 01:24 PM
  2. Why only 32x32? (OpenGL) [Please help]
    By Queatrix in forum Game Programming
    Replies: 2
    Last Post: 01-23-2006, 02:39 PM
  3. OpenGL book
    By macman in forum Tech Board
    Replies: 3
    Last Post: 04-03-2005, 10:58 AM
  4. Help with 2d OpenGL top-down shooter.
    By TonyP in forum Game Programming
    Replies: 4
    Last Post: 09-11-2002, 11:39 AM