ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I wish to learn basic 2d graphics programming in C under linux. I am an absolute dumb-a** in this regard and I have searched through google but didn't find anything that could help me.
Basically, I am looking for some guide that will tell me what library, what header file, what method calls, etc, I have to make in order to be able to make simple 2D graphics.
Like I already said, I am an absolute dumb-a** in this regard so I need complete spoon feeding. I need to know the basics, the header files that I should use in C, etc.
Later, once I know 2D, I would like to learn some advance stuff. I don't understand where to begin. Everywhere I just see references to OpenGL, but I wish to begin with absolute basics of 2D and then slowly crawl my way up the ranks.
Any help would be appreciated.
Thanks!
P.S. It's amazing how even after a 1000 posts, it seems best to say 'Any help would be appreciated' after requesting for help. Funny how no one has ever come up with anything else, dicounting TIA and all variants
1) Try libplot from `GNU plotutils' package. This library is very simple and powerful enough, well documented. In that package you'll find very useful (in my opinion) utils like `graph', `ode', `spline', ... http://www.gnu.org/software/plotutils/
2) Your program may produce PostScript-output which you can interpret with, say, `gs'.
3) svgalib - a low level graphics library for linux. Unlike previous with this one you can not plot anything in X-window, i.e. output appear in segregate console.
Another easy to use graphics lib is GD. Having said that, there are quite a few different types of graphics, and this is suitable for a small subset. Are you trying to generate charts & graphs, 'art', animation, print-quality... ? The type of graphic you want should be considered as part of your choice of library. You could, for instance, simply write C code that generates pure postscript, which would be rendered by some other device or program.
If you haven't already though about these issues, you should, and then ask more here after telling us some more of your plans.
What I want to do is the absolute basic stuff -- making dots and lines. filling color into boxes. The absolute beginner stuff. I wish to know how to get started. See, you guys have already suggested some things.
I *don't* wish to plot graphs or anything. I don't have to submit a project. All I want is to learn graphics programming using C under linux. Ubuntu specifically. Although, the distribution is not a concern.
A few years ago, I had done graphics in C using turbo C++ on winodws for a school project. I have done nothing in graphics since, and never anything on linux. So, I am an absolute illitrate.
Like I said above, I need a "from scratch" kind-of a guide.
what type of graphics programming. ? give an example of what you want to eventually be able to do. you mentioned about working up to opengl. are you thinking about game or simulation programming in the end or what.
ok, so I have got sdl installed, and I've been able to download some of them demos from the site and see how they work. Cool! It'd be nice if there are some noobie guides (no assumptions made by the author) for working with SDL now.
xhi: not games, really, but I was thinking more towards screen savers if you will.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.