Learning to create animations in C++ - c++

does anyone know where I can learn to create and manipulate animations in c++ for the purpose of game development?

GameDev.net would probably be a good place to start, they have links to plenty of tutorials for both DirectX and OpenGL. The NeHe OpenGL tutorials are a pretty good introduction. Microsoft alos has quite a few tutorials and sample applications that come with the DirectX SDK.

You'll want to use a library to display and manipulate 3D models. As Kevin suggested, OpenGL and Direct3D (DirectX) are the industry standard libraries - DirectX if you're target platform is Windows-only, OpenGL otherwise.
Is there a reason why you must learn this in C++? C++ is my favourite language, but the XNA Toolset (C#) is phenomenal and will have you up and running in no time:
http://creators.xna.com/en-US/ (windows only, but can compile to Zune/360 very easily)
Another great way to start learning about game development is to build some mods - Half-Life 2 and Unreal Tournament 3 would be my suggestions to start with; Half-Life 2 uses C++ and is very easy to work with (I have no experience with UT3).

Related

What is the standard OpenGL toolkit?

I'm just trying to get a grasp on OpenGL that I can build from, so all I'm looking for is something basic to build windows etc. One of the things I'm noticing as I read tutorials and such is that it seems like a lot of the information is out of date - for example a lot of tutorials (many of which were written a number of years ago) refer to using GLUT, but GLUT hasn't been updated in over 10 years - eons in computer time. What do people use nowadays? I know freeglut is out there, but there isn't a whole lot of info on it - how to get it set up, etc... what do most people do? What's the simplest way to get a simple window system up and running so that I can start playing around with OpenGL?
You should first understand the difference between Legacy OpenGL which is a fixed function pipeline, and modern OpenGL which is a completely shader driven pipeline. Most online tutorials teach legacy OpenGL because it is easy to get started and has been around a long time. Legacy still works fine, but you probably want to get into modern OpenGL (at least version 3.0). Modern OpenGL is cleaner, and more flexible, but also harder to get started in, and therefore has fewer tutorials. It requires a lot more setup and libraries by the user and there is no "one way" to do things making it difficult to structure a quick tutorial around.
Some good resources for learning modern OpenGL are:
http://www.opengl-tutorial.org/ - Great lessons written by Stack overflow user.
http://opengles-book.com/ - OpenGL ES 2.0 programming guide - OpenGL ES 2.0 is directly compatible with OpenGL 3.0, so it works great for getting started. Even if you don't want to buy the book you can download sample code which is excellent.
http://www.swiftless.com/ - Swiftless Tutorials - Great OpenGL 4.0 and WebGL tutorials.
To your main question I know of 3 main libraries for cross platform OpenGL window creation. I would recommend GLFW for a cross platform tool kit. You could also learn a lot by creating a context directly in your respective platform (WGL window creation on Windows, Cocoa on MacOS X etc) rather than using a windowing library.
GLUT - you are correct it has not been updated in years. It still works, especially for legacy OpenGL, but I'm not sure how good the modern support is.
SDL - Also old and legacy OpenGL (I think this is resolved with 2.0), and includes a lot more cross platform features beyond OpenGL like threads. It is a pretty heavyweight library but I still prefer it over GLUT. A modern, updated SDL was in the works, but i haven't seen anything for it in a long time, possibly discontinued... It also has a nasty license associated with it so watch out for that.
GLFW - My personal favorite. It is clean and lightweight like GLUT and allows you to target modern OpenGL contexts on most major desktop platforms.

C++ Game Programming Resources

Where can i get some advanced game programming resources for c++?
At http://gamedev.stackexchange.com ?
More specifically, this question and lots of others tagged with c++
Start with writing some simple 2D games, e.g. Snake, TicTacToe, etc. Write these using any GUI builder you're already familiar with.
Then try to rewrite these games using a serious graphic engine, e.g. SDL, OpenGL, or DirectX.
Then try to write a more complex 2D games, e.g. side-scroller. Write these games with the graphic engine of your choice.
Then add some simple 3D effect to your 2D game, e.g. parallax scrolling.
Then rewrite this effect with true 3D, use 3D models/sprites, 3D environment, etc, while maintaining a 2D look and feel.
Then add some simple 3D look and feel, e.g. allowing characters to move in the Z-direction (to/from the camera), doing camera rotation, etc.
If you just got out of the command prompt and simple GUI, you'll probably want to start simple.
I'd very much recommend OpenGL as your API of choice. Since you've done some simple GUI programming, you'd know what an API is.
OpenGL has the following advantages (compared to SDL and DirectX previously mentioned):
-Its hardware accelerated (SDL is not as far as I know)
-Its 3D (SDL is 2D)
-Its cross-platform (DirectX is Windows only)
By far the best place to start with OpenGL is the Nehe tutorials.
http://nehe.gamedev.net/
Game programming becomes evident once you become a bit more familiar with the API.
Also, I'd heartily recommend GLUT (OpenGL Utilities Toolkit). It simplifies window creation and user input handling, among other things. Its great for learning OpenGL. It also happens to be cross platform.
Here's freeglut, a free GLUT implementation:
http://freeglut.sourceforge.net/
OpenGL is also a relatively simple and easy API to learn. You'll be going into 3D in no time.
What libraries are you using? You can try GP wiki. It can be a bit hit and miss depending on what you want to use.
By "resources," do you mean tools? Libraries? Tutorials? I have a bunch of useful game developer links in the sidebar of my own site. I also think "Mathematics for Game Developers" was very helpful. It has a second edition as well.

What environment should I use for 3d programming on Linux?

One thing I always shy away from is 3d graphics programming, so I've decided to take on a project working with 3d graphics for a learning experience. I would like to do this project in Linux.
I want to write a simple 3d CAD type program. Something that will allow the user to manipulate objects in 3d space. What is the best environment for doing this type of development? I'm assuming C++ is the way to go, but what tools? Will I want to use Eclipse? What tools will I want?
OpenGL/SDL, and the IDE is kind-of irrelevant.
My personal IDE preference is gedit/VIM + Command windows. There are tons of IDE's, all of which will allow you to program with OpenGL/SDL and other utility libraries.
I am presuming you are programming in C, but the bindings exist for Python, Perl, PHP or whatever else, so no worries there.
Have a look online for open-source CAD packages, they may offer inspiration!
Another approach might be a C#/Mono implementations ... these apps are gaining ground ... and you might be able to make it a bit portable.
It depends on what exactly you want to learn.
At the heart of the 3d stuff is openGL, there is really no competitor for 3d apps, especially on non-windows platforms.
On top of this you might want a scenegraph (osg, openscengraph, coin) - this handles the list of objects you want to draw, their relationship to each other in space the ability to move one relative to the others, selecting objects etc. It calls opengGL to do the actual rendering.
Then on top of this you need a gui library. Qt, Fltk, wxWigets or one built into the scene library or written directly in openGL. This handles the menus, dialogs frames etc of your app. It provides an openGL canvas to draw into.
Personal choices are openscenegraph and Qt
For the 3D part, I strongly recommend the SDL Library with the OpenGL library
You can get some tutorials here
Qt has a pretty decent OpenGL-based graphics module.
Maybe you should consider using a graphics rendering engine such as OGRE. Coding a CAD program from scratch using OpenGL will take lots of time.
On Linux you have no competition to OpenGL.
It's one of the big players in the 3D field, so it's definitely worth learning.
This site has some excellent guides and code examples (on various languages).
You can use OpenGL with many languages, naturally on C and C++ but also for example with JAVA using LWJGL or other API's.
If you want to program at "a higher level" than opengl, use vtk. It is quite easy to get started and has bindings to many languages.
See www.vtk.org
you may use OpenSceneGraph for rendering.. it is an OpenGL based library..
and you may use OpenCascade.. it is good for 3D modelling...
we are implementing such an IDE at work and we use these things.. using pure OpenGL may be hard for you... anyway you may try...
for interface it is good to use Qt..
and i suggest you to use Eclipse if it is Linux..
(if it was Windows, suggestion would be Visual Studio)
For a C/C++ IDE, you have the following options:
KDevelop - KDE-based
Anjuta - GTK-based
Netbeans
Eclipse
Of course, you could also use a language like C# or Java:
Best OpenGL Wrappers for Mono and .Net
JOGL
There's really no reason why a simple CAD application would have to be written in C++.

From Direct3d to OpenGL

I currently rewrite an old Visual Basic application in java, a large part of the work involves replacing Direct3d with jogl.
Since I have no experience in dealing with Direct3d and only minimal experience using Opengl, I am stuck on finding appropriate replacements for the api calls.
Are there any good guides/tutorials or references?
Edit:
Additional information:
Direct3D version 8
I'd also recommend going through the OpenGL Red Book and investing some time in typing in some samples and playing with them. OpenGL Red Book deals with using GL in C, so I recommend you go through it in C or C++ before going to JOGL.
You don't have to play with everything, but making a few examples work in C++ would be great before you go on.
Otherwise, if you don't have the time or interest or will to study GL, just follow NeHe tutorials as mentioned in other answer, but take a peek every now and then into the Red Book for additional explanations.
The NeHe tutorials are a pretty good intro. They start here. Having Direct3D experience, you'll probably buzz through some of them pretty quickly.
I suppose you could try and browse through the code of this D3D -> OpenGL wrapper library:
http://sourceforge.net/projects/dxglwrap (using it as a reference I mean)
You can browse through it here: http://dxglwrap.cvs.sourceforge.net/dxglwrap/
NeHe tutorials will get you up to speed quickly. If you have time and need for something more comprehensive, you should get the OpenGL SuperBible.

Is GLUT dead?

After reading a discussion on Ubuntu Forums concerning GLUT vs. FreeGLUT.
Is GLUT dead for graphics programming? Is SDL all the rage now for OpenGL programming?
In my opinion, GLUT is still great to learn programming OpenGL in. It is no longer maintained, as far as I know.
Do look at : http://www.opengl.org/resources/libraries/glut/ for the official word
Extract from the above link -
"The GLUT library has both C, C++ (same as C), FORTRAN, and Ada programming bindings. The GLUT source code distribution is portable to nearly all OpenGL implementations and platforms. The current version is 3.7. Additional releases of the library are not anticipated.
GLUT is not open source. Mark Kilgard maintains the copyright."
Also look at : http://www.opengl.org/resources/libraries/windowtoolkits/ for alternatives.
You may also want to check out GLUX : http://code.google.com/p/glux/
As far as SDL being the rage, it is great for cross-platform stuff and many people are using it. I personally use Qt for my OpenGL work. Other windowing system alternatives also exist. It is also possible to program natively for windows or X.
Edit Feb 28 2017:
I should clarify that the student looking to jump into the practicalities of OpenGL would be better served by starting with SDL or Qt. As #TM rightly notes in his comment, using GLUT is far removed from the realities of programming a real world rendering application in OpenGL. My opinion that GLUT is good for learning comes from the thought that it is easier to learn when one separates the concern of learning an OpenGL from the concern of learning about the specifics of a Windowing system. Naturally, this may not match your needs.
GLUT is rather simplistic for serious game development. SDL is used by numerous commercial game porting companies. GLUT happens to be good for studying OpenGL and for simple demos. Something like SDL is quite good for actual games.
SDL with its abstractions for other things, such as audio, and SDL's various addon libraries (SDL_image, SDL_mixer, ...) help a lot when writing a full game. Having control over the main loop is also pretty important.
If you are working on an OpenGL application which needs some native GUI as well (for example, a 3D modeler) you may be more interested in using wxWidgets or, as batbrat suggested, Qt.
GLUT is a very useful learning guide, but it's not full featured or useful enough for most real-world applications. I've also encountered minor issues with a few different GLUT implementations and support in some environments, so I've learned to stay away from it for anything but quick demos.
My OpenGL experience has generally been on embedded systems where I have complete control over the output, and there I use X Instrinsics to get the basic OpenGL Window up. It's a bit painful, but it's a small amount of code to get to OpenGL, where the bulk of the work is done.