Hi, I'd like to learn some basic graphics (2D) that would be easy to use and quick (So no OpenGL, or Direct X). Also, it NEEDs to have Linux portability.


I've already tried Allegro and paintlib, neither of them could I install and they didn't look quite as easy as I wanted (though that'd be fine if there's nothing easier)

jt

You could look at agg.
There are several examples on the site that show how easy it is to plug the components together. Basically, it's just a bunch of facilities for plugging together behavior in a pipeline. The facilities themselves, however, are fairly simple.

How can I use that?

I use ubuntu and Code::Blocks with g++

Can you direct me to a place where I could learn it?

Thanks

You can download from the website and install by hand. On linux, it is as simple as typing make in the top-level directory. There is an examples directory that has many sample programs. Under that directory you will find several platform specific directories - you probably want X11. In X11 you, again, just type make .
the source is fairly readable and the website has tutorials.

I have done what you've said and when I try to compile some of the stuff that comes with it, it fails to do so and returns an error saying that the library that the graphics library is using doesn't exist. I found the button that would allow you to add something to the folder of libraries in Ubuntu. However, in the directory where I did the make commands (I'm assuming the make files) there are no ".a" or any other type of library. What should I do to make code blocks recognize the library?

Where is your problem, exactly? With code::blocks, or the original build? I've built on RedHat and Debian without issue so I'm going to assume that the problem is with code::blocks integration.

First, can you run the programs that were generated during the build (run them from the command line)? For example:

[ ~/agg-2.5/examples/X11 ] $ ./graph_test

Can you do that? If yes, then you have a working library.

Now, the library that you are looking to use (the .a you are talking about) is located in the src directory. So something like:

[ ~agg-2.5/src ] $ ls
...
libagg.a
...

If you look in the examples/X11/Makefile you should see the linker flags you have to add to use that library. Something along the lines of -L../../src . Realize that in code::blocks, you will probably have to supply the full path to that file. I cant help with that as I do not use code::blocks as my development environment.

Please let me know if these are not the problems you are experiencing.

The first command, done in the terminal didn't work (there apparently weren't enough "]"s).

I understood you to say that if the first thing didn't work then the rest wouldn't work. Is there anything else I can do?

Oh, um, here is the sequence of things that need to happen in the terminal. What I showed was a prompt with command; not an actual command itself.

In the following, LOCATION referes to the location of the agg-2.5 directory.
Open a terminal.

cd LOCATION
make
cd examples/X11
make
./graph_test

Each make should take some time to actually compile the sources.

That worked perfectly, all I have to do now is make codeblocks recognize it.

Thanks,
jt

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.