Easy to use drawing library in c or c++? - c++

I'd need a very easy to use drawing c or c++ library. This means that I don't need to put buttons, frames or anything else in there, but I need just to draw points, circles, lines on a graphic window. Is that possible?

Cairo is a nice option if you are looking for ease of usage.

You can use one of the many C++ creative coding frameworks:
Cinder
openFrameworks
polyCode

If you are working on Windows, try Direct2D, it's very powerful and equally simple to use.
More info at : http://msdn.microsoft.com/en-us/library/dd370990%28v=vs.85%29.aspx

SDL is pretty nice. If you really want to get involved, Direct3D and OpenGL are probably the best options.

Try SFML: http://www.sfml-dev.org/

You should be a little more specific:
What platforms do you want to target?
What do you exactly mean by "easy to use"?
If you are using Windows and just want to learn the concepts of computer graphics, just use the Windows GDI.
If you want to learn computer graphics for mobile devices, use OpenGL. It is a bit harder to use than the Windows GDI, because it is a lower level API, but it is more powerful.

Anti-Grain Geometry has some really nice results. It's not difficult to use. It's a C++ library and I don't know if there are C bindings.

Related

The simpliest way to visualize - easy-use graphics. Which languages and lib?

I'm going to develop math model of trafics simulation and will need to somehow vizualise it. The model will be in C++
I'd like someone to recommend me how can I visualise the result data file - e.g. paint cars, road etc. Language choose is not important but should be easy enough to go into.
os: Win32
UPD:
It'd better be the 2D not 3D
but actually - doesn't matter
Best quality and most general software I've seen is Graphviz.
http://www.graphviz.org/
I've heard lots of good things about VTK (not yet had the occasion to use it myself).
The Wiki contains lots of C++ examples.
Although I do not know how (or even if) it interfaces with C++ you may be interested in processing to quickly build visualizations.
If you want more 2D than 3D and if you know C++, then using Qt and notably its Qt Graphics View framework could be ok.

3-d animation in C++

I am doing a scientific project in C++ and I need to draw simple animated 3-d images of moving atomic groups. What is a good and convenient graphics library to do that? Some general remarks are also appreciated. I work in Linux.
Thank you in advance, Roman
OpenGL of course,
one library you could use is glut for that.
have a look on http://nehe.gamedev.net/
If you want to show 3D in linux, you should use OpenGL. But since it is a C library, you can use a wrapper, like for example glt or sfml
The easiest library to use is Vtk. A more difficult and slower, but potentially better rasterization can be achieved using POVRAY.
I suggest looking at game oriented graphics engines. They provide OO wrappers around openGL and have lots of utility functions for loading 3d model formats etc.
If you don't want to get bogged down in writing the graphics, a game oriented renderer is likely the fastest way for you to get stuff on screen.
Ogre may be a good choice - it has a fairly large and helpful community.
Irrlicht is another possibility.
There are several possibilities, some perhaps more suitable than others, obviously!
I think any one of the options mentioned above would serve to do so.
I personally recommend OSG.
http://www.openscenegraph.org/projects/osg

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.

Mac dev - Help getting started with 2d games

I want to make some simple 2d games/clones (for Mac), but I have a few questions:
Should I use Quartz 2d or OpenGL (I don't plan to try 3d anytime soon)
There seems to be a lot of typedef'd things like CGFloat/GLfloat, which should I use?
Should I use Objective-C for the game too (classes) or just C? (I assume I'll use Objective-C and Cocoa for window and views.)
Is it fine to redraw the entire view each time? I don't really understand how the NSView's -drawRect dirtyRect parameter works, how does it know what I want to update?
Are there any good tutorials for this?
Thanks.
Quartz or Core Animation vs. OpenGL really depends what you're trying to do. If you want simple drawing and animation, use Quartz or CA. If you want fast/powerful games, use OpenGL. Eventually I'd suggest learning both.
For the typedef'd things, use whichever is meant for the specific system you're using. For Quartz/CA/CG, use CGFloat. For OpenGL, use GLfloat.
Objective-C vs. C also depends on the speed you want. Objective-C adds a little bit of overhead but will (obviously) let you create much more object-oriented games. I'd suggest using Objective-C if you use Quartz and Core Animation, and either Obj-C or C if using OpenGL. However, if you're doing this on a Mac (e.g. not for iPhone), you probably won't see much difference unless you're doing complex fast drawing.
I'm not entirely sure about drawRect, but this question has some information which may answer that question for you.
For an intro to Quartz, I'd recommend this tutorial, and I've always heard the NeHe tutorials recommended for OpenGL.
If you use SDL with either Cairo or OpenGL, you get virtually the same programming model, but you get cross platform compatibility virtually for free. You should even be able to continue using objective C for the bulk of the game, if you want.
How graphically intensive do you want to get? Cairo will probably be easier to just get going with for 2D.

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++.