Thread: C++ animation through bitmap and OpenGL

  1. #1
    Registered User
    Join Date
    Dec 2009
    Posts
    2

    Unhappy C++ animation through bitmap and OpenGL

    Hello,

    I am currently a high school student taking C++. We were recently given time to create a college football game that must include animation. I have created bitmaps using Photoshop and have a scoreboard ready to be used. However, I am having a lot of trouble and finding myself in pain trying to find the coding to open the bitmap file then proceed to display it. I would greatly appreciate it if anyone could point me in the right direction or have a small explanation to go about this correctly.

    Thank you

    -egor

  2. #2
    Registered User
    Join Date
    Nov 2009
    Posts
    82
    A 'more' user friendly framework you can use with C++. Simple DirectMedia Layer

    Lots of examples and tutorials on how to use SDL out there.

    http://www.libsdl.org/tutorials.php
    Last edited by since; 12-03-2009 at 11:33 AM.

  3. #3
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Quote Originally Posted by egor View Post
    Hello,

    I am currently a high school student taking C++. We were recently given time to create a college football game that must include animation. I have created bitmaps using Photoshop and have a scoreboard ready to be used. However, I am having a lot of trouble and finding myself in pain trying to find the coding to open the bitmap file then proceed to display it. I would greatly appreciate it if anyone could point me in the right direction or have a small explanation to go about this correctly.

    Thank you

    -egor
    Has to be OpenGL?

    Try the tutorials at NeHe NeHe Productions: Main Page
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  4. #4
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472
    i find it amazing that you are being told to use openGL for high school project? assuming that it is your first programming course, in my opinion it should be something you move on to after a solid grounding in techniques for graphics, using a simpler library, and C++ features in general are well understood, use SDL as already suggested

  5. #5
    Registered User
    Join Date
    Nov 2009
    Posts
    82
    rogster001, I was thinking the same, it is pretty nuts.

    After some experience, sure it's actually pretty straight forward but... there really is a lot to understand before you work with graphics. I was going to suggest using Macromedia Flash instead, far more intuitive and easier to work with... at least relative to C++/OpenGL.

    egor,

    I hope you have a strong understanding of program flow, class design, basic game programming concepts, etc. Game programming is actually a huge composite field of many sciences, techniques, system design models. It can be overwhelming if you're not used to it.

    Granted, 'simple' games shouldn't be a big deal, but even the simplest games require some decent class design so your game structure doesn't break down in to an incoherence mess which becomes unbearable to manage..
    Last edited by since; 12-04-2009 at 10:05 AM.

  6. #6
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    I was going to suggest using Macromedia Flash instead, far more intuitive and easier to work with... at least relative to C++/OpenGL.
    It is? I think it's more of a pain than anything. The ActionScript 'language' always works against what you want to do which makes me wonder....why am I using it in the first place?

    If you need quick rendering for a project then I would suggest something like OGRE or Irrlicht (Irrlicht I believe is no longer supported). However if you do not understand rendering and graphics it is highly probably neither of these systems will help you much. Bitmaps and animation should be a snap long before you move to OGRE or some other API.

  7. #7
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Quote Originally Posted by since View Post
    I was going to suggest using Macromedia Flash instead, far more intuitive and easier to work with... at least relative to C++/OpenGL.
    It's been Adobe Flash for a while now

    Quote Originally Posted by Bubba View Post
    It is? I think it's more of a pain than anything. The ActionScript 'language' always works against what you want to do which makes me wonder....why am I using it in the first place?
    ActionScript is a language, and has been in my eyes since version 3. I don't agree it's intuitive, because of it's bloated syntax (for a scripting language) and resembles Java too much now. It's not the language I have a problem with though, it's the compiler. Adobe's ActionScript compiler is rubbish. I've switched to haXe (custom compiler), and now I can compile my Flash (swf) natively on Linux with any IDE and with all the advantages of the haXe "langauge" (more of a very extensive preprocessor). It's a lot better. Although leaves something to be desired, because of restrictions like capitalized class names, etc. Any variant of Java seems to be a pain. It's just a very minor pain with haXe, and the speed boost more than makes up for it.

    The reason you're using it, is because Adobe Flash is the most comprehensive and accessible web VM available. If you're targeting web applications, then you don't have a choice (unless you actually consider Silverlight a choice, ha). I would go with Java applets, but then I would regret it.

    Quote Originally Posted by Bubba View Post
    If you need quick rendering for a project then I would suggest something like OGRE or Irrlicht (Irrlicht I believe is no longer supported). However if you do not understand rendering and graphics it is highly probably neither of these systems will help you much. Bitmaps and animation should be a snap long before you move to OGRE or some other API.
    Irrlicht no longer supported? That's news to me. It's also easier to get started with than OGRE, although more limiting (which is fine for this project).

    I'd still go with SDL.
    Last edited by Dae; 12-04-2009 at 08:54 PM. Reason: haXe allows more than 1 public class per file
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  8. #8
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    The reason you're using it, is because Adobe Flash is the most comprehensive and accessible web VM available. If you're targeting web applications, then you don't have a choice (unless you actually consider Silverlight a choice, ha). I would go with Java applets, but then I would regret it.
    That's one valid use of it indeed, but not the only use.

    Irrlicht no longer supported? That's news to me. It's also easier to get started with than OGRE, although more limiting (which is fine for this project).
    Seems that way. I went looking for various rendering APIs and saw a blurb about it either not being supported or being re-factored or something along those lines. And yes OGRE does seem a bit complex albeit that is more due to the horrid documentation it has and the really awful demo app it comes with. I just wanted a hello world app for OGRE and what I received instead was a solution with literally 20 projects in it.

    EDIT:
    The .NET version of Irrlicht is no longer supported.
    http://irrlicht.sourceforge.net/phpBB2/index.php
    Last edited by VirtualAce; 12-04-2009 at 06:46 PM.

  9. #9
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    I believe Irrlicht is still around. It had an update near the end of September if I recall correctly. The forums are still alive it seems. Although Ogre3D is definitely a much more powerful, and flexible system.

  10. #10
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Quote Originally Posted by Bubba View Post
    That's one valid use of it indeed, but not the only use.
    Yup, guess that answers "why am I using it in the first place?"

    Quote Originally Posted by Bubba View Post
    The .NET version of Irrlicht is no longer supported.
    Oh noes, lol!
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  11. #11
    Registered User
    Join Date
    Feb 2009
    Posts
    40
    If you are programming in C++ should you prefer to use SFML instead of SDL.

    SFML - Simple and Fast Multimedia Library

  12. #12
    Registered User
    Join Date
    Nov 2009
    Posts
    82
    Oh, almost forgot this one, it's been growing wildly in popularity with a large number of programmers/artists; Processing 1.0

    And if anything else, look at processing's tutorials, they are absolutely fan-frigging-tastic for anyone remotely new to graphics programming. I'd say that sites tutorials are probably the best on the internet for people just getting in to these things.

    http://processing.org/learning/
    http://processing.org/learning/topics/
    Last edited by since; 12-05-2009 at 09:15 AM.

  13. #13
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    The .NET version of Irrlicht is no longer supported.
    Because it has been superseded.
    And that version too, has been discontinued. Somehow, there seems to be insufficient need in the community to keep such a project running.
    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
    Join Date
    Dec 2009
    Posts
    2
    OP here.

    We do not need to use an OpenGL, the only reason I suggested that was because the information I have found has told me i need to use an openGL. All I really need to know is how to open and display a saved bitmap from my hard drive and assign it to a variable using C++ Visual Studios.

    Thank you all for your suggestions.

    -egor

  15. #15
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Are you using WIN32 or MFC?

    GDI is MUCH easier than OpenGL.

    Load the image in the WM_CREATE or WM_INITDIALOG into a global variable or static var in the callback.

    The variable to hold the image is a HBITMAP. Use LoadImage() (or the older LoadBitmap() ) to open and load the image from file (or resource).

    Display is with a BitBlt() within the WM_PAINT msg.

    Search the Windows forum for code.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 10:17 AM
  2. Loading a Bitmap resource for OpenGL Texture[x]
    By the dead tree in forum Game Programming
    Replies: 4
    Last Post: 08-26-2004, 01:12 PM
  3. 2-D background bitmap behind a 3D wold using OpenGL
    By Laeeqhamid in forum Game Programming
    Replies: 6
    Last Post: 12-28-2002, 04:42 AM
  4. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM
  5. Adding bitmap as a resource for texture mapping in OpenGL
    By Unregistered in forum Game Programming
    Replies: 2
    Last Post: 03-03-2002, 02:03 PM

Tags for this Thread