How to display Sprite/image in c++?

What are the options to load the image from C++ for a small 2d game?
Well avoid using the console as the platform for developing for starters. Try using one of the many libraries out there to handle graphics, audio, key presses, ect. Here are some of them:

SFML: http://www.sfml-dev.org/download.php
Tutorial: http://cpp.wikicomplete.info/tutorial:setting-up-sfml

SDL: http://www.libsdl.org/
Tutorial: http://lazyfoo.net/SDL_tutorials/lesson01/index.php

OpenGL: http://www.opengl.org/
Tutorial: http://www.glprogramming.com/red/about.html

Hope this helps.
Last edited on
Again standard C++ libraries fail to provide an imaging library again. Try the above URL.

In Java SDK, there is a Java2D API built-in for manipulating images with operations like read/write, adjust contrast, texturing etc etc. Not efficient but good enough for a small 2D game :P
+1 vote for SFML
SFML is available for use in C, C++, D, .NET (C#, VB.net), Python, OCaml and Ruby.


I wonder why it is not available for Java. Perhaps Java SDK already has and they don't want duplication of effort ? Hmmm.....
Thanks MottMan...I will go with OpenGL.

FWIW, you can use OpenGL directly with SFML, but SFML automates things like window creation, music playback, input, image loading, etc, etc, etc. Whereas OpenGL alone only does the graphics.

If you don't want to use SFML's graphics and prefer OpenGL, I'd still recommend SFML as it makes things overall much easier.

Also, SFML's rendering engine uses OpenGL under the hood, so it's not really that much slower than using OpenGL directly (and it's tons easier.
@MottMan, Disch,

I am on the graphics chapter of my C++ book. The author recommends FLTK for the GUI. Are the ones you mentioned good for beginners? Are they compatible with the VC++ IDE? I would like an extremely user friendly GUI so that I can concentrate on the C++ code rather than getting the GUI to install and work correctly.

SFML (from what I've skimmed) is very user friendly (as far as libs go). The one thing you may have trouble with is installing and setting up but most people would tell you it is worth it. I have used SDL which is quite easy to setup, but most of the function calls are clumsy or have odd syntax. SFML is great for everyone.

Oh, and yes, as far as I've heard you can use SFML fine with VC++.
Topic archived. No new replies allowed.