Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 09-06-2005, 04:15 AM   #1
Registered: May 2004
Distribution: Debian sid amd64
Posts: 35

Rep: Reputation: 15
Looking for a 2D graphic C++ library


I'm writing a server program in C++. This server aims to provide map to the clients. Actually, the server need to draw the map corresponding to a request.

So i have a thread pool, each thread is attached to a conenction. I'd like to perform each drawing process in a thread, save the result in buffer and send it to the client.

I'm looking for a library that could enable me to perform this. I've tried Qt (v3 & v4), but it's not able (ot I don't manage) to draw in an multi-thread program. As far as i understand it's due to Xlib limitation which don't manage multi-threaded program. ( )

I also have a quick look to openGL, but it seems that most of implementation use Xlib to perform some drawing process, and it seems to not be recommended to use multi-threaded program. Gtk seems to suffer the same limitation, since all gdk/gtk functions call must be wrapped in the thread lock, I didn't try it, but if each drawing process have to lock the thread, I'm afaid I'm losing the thread parallelism advantage.

I also have a look to Magick++, but the main problem is GPL.

So I'm looking for a C++ library that could perform 2D graphic operation in different thread, i.e without callin Xlib method.

Maybe, I've missed something, and Qt, openGL, GTK can do a such thing, but I can't figure it out.

Thanks a lot for you help.

Edit: I've just found cairo and glitz, have someone ever use those libraries ?

Last edited by punx120; 09-06-2005 at 04:49 AM.
Old 09-06-2005, 03:51 PM   #2
Registered: Aug 2004
Location: Europe
Posts: 608

Rep: Reputation: 50
Try GD library. I think it is exactly what you are looking for.
Old 09-06-2005, 04:15 PM   #3
Registered: May 2004
Distribution: Debian sid amd64
Posts: 35

Original Poster
Rep: Reputation: 15
Thanks for the link, i will have a close look to it.
Old 09-06-2005, 06:52 PM   #4
LQ Guru
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
In general, you should never multithread the user interface. This is equally true in GTK+, in X windows ... and in Windows/MFC and Java!

That doesn't mean your *application* can't be multithreaded: it just means that your design should insure that only one thread is ever interacting directly with the user interface.

Frankly, Gtk+ (along with many others) might be an *excellent* choice for 2D graphics (openGL might be overkill, at least until you get to 3-d graphics and rendering).
Old 09-07-2005, 01:53 AM   #5
Registered: May 2004
Distribution: Debian sid amd64
Posts: 35

Original Poster
Rep: Reputation: 15
Actually, I don't want to multithread the UI, I don't have a UI, it's stil a console program.

The reason I use Qt (Gtl and others) is that I need to draw Images (off the screen) and send them to clients.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
adding a bulit in library to my library lg3 Linux - Software 1 10-17-2004 09:19 AM
howto compile bin with my library using all-static and shared linked standart library stpg Programming 4 06-29-2004 05:20 AM
what is the function library of the basic graphics library in rethat9.0? zerwolve Red Hat 0 04-29-2004 10:18 PM
problem compilin hermes graphic library 1.3.2 freeindy Linux - Software 0 12-27-2003 10:46 AM
Graphic csosa Linux - Software 2 09-24-2003 01:00 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:22 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration