C++ Graphic API with a small learning curve - linux - c++

i have to do some very basic drawing in Linux , like joining some points , tracing trajectory of a moving point . I am looking for a graphic library which has a very small learning curve so that i can save my time and avoid getting into things like gtk and opengl since i don't need something complicated .
Edit 1 :Can you provide links to the tutorials for SDL which explains very basic drawing also for any other libraries which you think is relevant .

You want pygame, Allegro, or SDL with SDL_gfx. All of these are available through the most popular package repositories.
Be prepared to get used to dealing with surfaces, graphics primitives, blitting, and the like. The learning curve is not large, but it's still a significant paradigm shift if you've never done graphics before.

I was taught with FLTK, and as the middle aged man says "I turned out OK didn't I?"

You might be also interested in Cocos2dx, it works on many different platforms (linux included).

Related

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.

Creating effects in 3D game from scratch, using c++ and DirectX

So the title says it. I couldn't find any info on how actualy build effects into 3D game. I'll maybe stick to some engine later, but for understanding of this whole thing I would need to try it on my own for this time. I found a few about particle systems which may be the right way but any other connection between DirectX and particle systems on google gave results as 3DSmax and etc.
So I would be thankful if you would point me on some tutorials for this, or explaining it...
Last possibilitie would be pointing me on some simple engine focused on this thing (I don't really want to fight through tons of code and understanding how this engine works, I just need to see how they implement this FX stuff).
Thanks
PS: the other possibilitie would be if you know about good book discusing this. It can be more complex but apart from tutorial, books are usually wrote more basicly so this would be also nice way to go
First of all: particle effects are just one kind of effects, it's better you specify the word particle engine :p.
Secondly: search int he articles of Gamedev, it's really the best resource if you want things like this. You can find lots of articles and even better, tons of links, and useful information on the discussion boards. Two articles I can link to is the NeHe lesson about particles in OpenGL, it's not directx but NeHe tutorials for OpenGL are very good. I also found one for directx8 and VB (so a little bit older).
Keep in mind though that a particle engine is often a huge performance hit if you can't optimize it yourself, so try to look at open source game engines (e.g. OGRE) on how they implement it or even better, specific particle engines.
So I would be thankful if you would point me on some tutorials for this
You need to download microsoft DirectX SDK.
In addition to it, you should try NVidia SDK.
You may also try ATI SDK. Study them all.
In addition to them... there are couple of books on OpenGL: "Red Book", "Blue Book", Orange Book . "Computer graphics using OpenGL" by Francis Hill is also a very good one.
Get this info, and start reading.
how actualy build effects into 3D game
This question is too broad. There are lighting effects, particle systems, post-processing effects, physics (which are also effects), and even character animation is an effect. It is unclear what kind of effects you are talking about.
What do you think is better DirectX or OpenGL.
They are more or less equal. You can do same things in both of them. Try both and pick one you liked more. OpenGL is better for playing around and experimenting (because you can easily draw triangle without messing with hardware buffers), available on larger selection of platforms, plus GLSL is better than HLSL (because it doesn't "compile into assembly"). DirectX is geared towards performance from the beginning, available on XBox360, and 9th version was actually good. openGL is more "abstract" and DirectX is closer to hardware.
If you could use the factors as simplicity, area of usage, performance, number of examples and resources etc
If you want simplicity, you should forget about making game engine. You'll have to learn quite a lot of things if you want to deal with 3D.
Both DirectX and OpenGL are used for making 3d-related products.
You can get good performance with both DirectX and OpenGL, and get poor performance if you don't know what you're doing.
Both DirectX and OpenGL have insane amount of examples and books - just search for it. They weren't made yesterday, so enough information is already available.
You need to select goal, select platform, select your API, research available technologies, and start writing code. Wondering "which one is better" is a waste of time. 3D knowledge and algorithm are equally applicable to both APIs.
OpenGL is the best bet to learn I feel. Glut is available free of cost and has all the functions you need to implement a particle engine. Plus theres loads of sample code online. I like the way functions are . Easy to remember and use logically
The best books for learning D3D9.0c/D3D10 are by Frank Luna. Just put him in to amazon or google and you'll get results. He teaches how to build a fully-fledged game engine from scratch.

graphics programming

I would like to program some graphic figures such as line, circle,etc. I have used turboc++ 3.0 for
dos graphics. I would like to do the same with the compilers dev c++ or code blocks or vc++.
I would like to implement dda and bresenhems line and circle drawing algorithm.
how should I go about implementing these programs through these compilers (not the command line tools).
I have a really vague picture of graphics programming.please help..
please note : I have a nvidia graphics card 1gb.. so I cannot use dos graphics (I think the card is the reason).
If you're wanting to play around with graphics code to draw objects and do things with them may I suggest that you skip the whole Windows/GDI/DirectX/ thing completely and take a look at Processing?
It's basically Java, so you won't have to jump too far for the language, but more specifically it's designed for playing around and experimenting with graphics, so may suit you perfectly.
You really have a vast variety of options. Starting from GDI (not hardware accelerated), finishing with a heavy stuff like DirectX, OpenGl. There is also a nice library, called SDL. It does not really matter what technology you will use to solve your problems. If the speed is not a matter, i think GDI is the right and most simple choice.
You may want to start off with these tutorials:
http://www.tutorialized.com/tutorials/C-and-Cpp/Graphics/1
From the sound of things, you're trying to produce a program that runs on Windows. In that case, you don't need to implement basics like Bresenham's algorithm to be able to draw lines and circles. Windows provides MoveTo and LineTo to do basic line drawing, and Ellipse to draw ellipses -- and if the axes are equal, the ellipse it draws will be a circle.
Edit: It also sounds like you haven't written any code for Windows. This is quite different from writing code for DOS, so you'll probably need a good book. Charles Petzold's Programming Windows is a classic (though for C++ you'll want a somewhat older version -- I believe the current ones concentrate on the .NET languages).
I am using the powerful cross platform project: http://cimg.sourceforge.net/ .
you have there all primitives and more.
I you wish to use your GPU power you can use glut library for OpenGL.
cheers Arman.

Is there a middleground between writing raw OpenGL versus using a full-blown game engine?

I'm playing around with OpenGL and I'm finding myself writing code that I feel like I shouldn't have to write.
GLU and GLUT are nice but not really what I'm thinking of.
Code to load .obj models (vertex and normal vectors) from Blender and render them.
Code for collision detection.
Code for navigation/camera stuff.
Code for simple terrain generation.
But at the same time I feel like a full-blown game engine is more than I need.
Are there any good libraries built on top of OpenGL that I could take advantage of, perhaps to create relatively simple games? I don't necessarily need all of the items listed above. Those are just examples of what I'm thinking of.
Yes.
I can't be more specific as I don't write my own game engines but I do have a list of libraries online at this location, most of which sit below being a full engine.
Ogre
Irrlicht
openscenegraph (replaces performer)
Depending on how much you need, one of these toolkits / libraries might suit your purpose.
GLUT - OpenGL Utility Toolkit
Ogre3D - OGRE Object Oriented Graphics Library
Open Inventor - OpenGL toolkit for scene management created by SGI
Performer - OpenGL toolkit for real-time rendering created by SGI
I learnt my opengl stuff from GameTutorials and Gamedev. Unfortunately gametutorials are no longer a free selection of tutorial (there's some examples) but they were good. Coupled with SDL, you would have code to do everything you wanted - and you'd be able to understand what is going on under the covers, something I find is very useful later on (if, for example you wanted to write HTML5/WebGL code later).
A lot of the game engines aren't as well documented as I'd like (well, weren't a few years back when I was looking), but they might still do what you need. Sourceforge has many, including Ogre3d, Irrlicht, and CrystalSpace.
In general I agree with your sentiment. There is a school of thought that says that programming should consist of pluggable modules. Once youve written an OpenGL app, you should be able to grab a model loader, and/or a skeletal animation engine and plug them in.
The depressing thing is, most of the game engines on that list (that Ive looked at) are all or nothing propositions. They provide an entire framework and do not really take into account the more common real case scenario.
That said, all is not lost. A lot of those engines package up a number of other 'utility' libraries into their distribution. With a bit of patience it is possible to piece together the component libraries yourself: OpenAL for the sound, Freetype for font rendering, libpng, libjpeg etc for image codecs

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.