LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 12-29-2004, 05:19 AM   #1
saint_devil
LQ Newbie
 
Registered: Dec 2004
Distribution: saint
Posts: 14

Rep: Reputation: 0
Unhappy How To Use Graphics in C/C++ in Linux ?


Hi! There

I m new to Linux and I want to do programming in c/c++. How can I use Graphics in it. In turbo c++ IDE there is bgi files. How can I do in Linux.
Please Help Me. Thanx.
 
Old 12-29-2004, 05:47 AM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
There are many options, i.e. different graphics libraries to choose from. Most well-known are:

Qt: http://www.trolltech.com/products/qt/
GTK: http://www.gtk.org/
wxWindows: http://www.wxwindows.org/

And especially for game-like programming:
SDL: http://www.libsdl.org/
 
Old 12-29-2004, 07:37 AM   #3
deveraux83
Member
 
Registered: Jul 2003
Location: Malaysia
Distribution: Red Hat, Slackware 9.1
Posts: 76

Rep: Reputation: 15
I presume u want console graphics since that is the only graphics package that I am aware of that is provided with Turbo C++ IDE. If so, the package you might want to try is ncurses which based on "escape sequences" passed to the terminal.

But if you want X-Window graphics programming, follow the links provided by Hko.

Hope this helps!
 
Old 12-29-2004, 08:39 AM   #4
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 32
Quote:
Originally posted by deveraux83
I presume u want console graphics since that is the only graphics package that I am aware of that is provided with Turbo C++ IDE. If so, the package you might want to try is ncurses which based on "escape sequences" passed to the terminal.
Actually, Turbo C++ also came with libraries for doing VGA graphics, and you could get a library that let you go into SVGA modes as well. If I remember correctly, it had functions for drawing lines, circles, individual pixels, etc. etc... Since the user is talking about BGI files, I assume that this is actually what he is looking for an equivalent too. If I remember right, the BGI files were like the "libraries" you used to get into graphics modes.

To answer the original user... I believe that SDL provides a similar interface. And if you want to get into 3D programming, you should also look into OpenGL.

Last edited by deiussum; 12-29-2004 at 08:45 AM.
 
Old 01-02-2005, 01:52 PM   #5
stenquist
LQ Newbie
 
Registered: Jan 2005
Location: Houston, TX (previously Sweden)
Distribution: Debian Woody 3.0
Posts: 3

Rep: Reputation: 0
QT from Trolltech

I have just started doing this same C++ endeavour using QT from Trolltech. If you get stuck installing it, you may have to install from source. In that case refer to the 'Building QT for X11, Linux' thread. Hope you don't have to go thru the pain I did.

Carl/Houston TX
All the armies, navies, parliaments, and kings, put together, have not affected the life of man upon this earth, as has Christ.
 
Old 01-02-2005, 08:53 PM   #6
Hosiah
Member
 
Registered: Sep 2004
Location: Des Moines, Iowa
Distribution: Slackware, Mandriva, Debian derivatives, +BSD/ Solaris/ Minix/ plan9/ GNU/HURD...
Posts: 185

Rep: Reputation: 31
I, too, am right at about the same place in my studies.

I got going with the ncurses library, thanks to the splendid tutorials available online. Then I thought, first I'll pick up VGA graphics, then OpenGL, and finally X Windows GTK operations, and I'll be reasonably confident that I could tackle any project in Linux that I wanted to.

Unfortunately, I've hit a snag. I found this tutorial at svgalib.org and tried it, but no go. I'm running Red Hat 9.0. The system doesn't seem to come with the "VGA.h" that it's talking about, nor does it recognize the library call. I _did_ search for and found some files called VGA.h on my system (none of them in the include directories), and they're all asm system calls and such...no drawing functions declared!

Since then, I've kinda shrugged and given up on console graphics. Recently, I tried downloading the source code for Linux screensavers. But these (spirograph.c, vermiculate.c, for example) #include <screenhack.h>...another file I don't have on my system!

Anyway, maybe with a different system these two methods will work? As for me, I'm still stuck on this one. It really speeds up your learning, if you can simply doodle lines and pixels on the screen. That way, all the junk you have to learn about pointers and structs has a better chance of sticking with you, if you can _use_ it to make simple graphical representations of your data structures.

Anybody have any idea how I can get this? Or just truck on to OpenGL (which I also did in my Windows C days, and found relatively simple to figure out with tutorials from gametutorials.com and a site I remember called NeHe something)?
 
Old 01-02-2005, 09:57 PM   #7
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
... or truck over to Qt ...

If your primary needs are:

1. User interface (pushbuttons, menus, scrollbars, etc)
... and/or ...
2. 2D graphics

Then I'd strongly recommend Qt.

If your primary needs are:

3. General 3D graphics + UI

Then I'd again strongly recommend Qt.

IMHO ... PSM
 
Old 01-03-2005, 06:08 AM   #8
saint_devil
LQ Newbie
 
Registered: Dec 2004
Distribution: saint
Posts: 14

Original Poster
Rep: Reputation: 0
Thanx Buddies for Taking intrest in my problem. Surely I'll try this.
Thanx Again
 
Old 01-03-2005, 10:27 AM   #9
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 32
Before you learn OpenGL, you should learn some basic Windowing system. Since OpenGL is designed to be platform independent, it doesn't provide you with a means of creating the initial Window. You can use cross-platform Windowing APIs like glut, SDL, wxWindows, etc. to create the window, and initialize OpenGL fairly easily, though.

I'm not sure if Qt has any sort of OpenGL widgets, but if it doesn't you can always resort to the glx function to initialize a window to use OpenGL...
 
Old 01-07-2005, 04:07 AM   #10
Hosiah
Member
 
Registered: Sep 2004
Location: Des Moines, Iowa
Distribution: Slackware, Mandriva, Debian derivatives, +BSD/ Solaris/ Minix/ plan9/ GNU/HURD...
Posts: 185

Rep: Reputation: 31
paulsm4>
Quote:
Then I'd strongly recommend Qt.
But I searched out Qt, and it seems to be payware???

No, no, I've made it a rule to stick to freebies only.

Speaking of which, anybody seen what Macromedia's charging for their latest Flash Development kit? I clicked through out of curiosity. Brace yourself: $899.!!!

When a simple graphics development kit costs more than a top-of-the-line, loaded complete computer system, something is VERY WRONG! It's totally worth learning Linux graphics, just to write a cheap knockoff of Flash and give it away free!

*update*---> oops, stupid of me, paulsm4, you mean the QT development dingus that came with Red Hat! Yes, I've worked through the tutorial in Qt and it is one slick lil' program, alright, but I was talking about graphics libraries as in game development, not necessarily graphics as in windows and buttons.

I can second the recommendation on Qt. I regard "Visual" development interfaces as a barely-necessary evil at best, and even I have to admit that Qt rocks.

Last edited by Hosiah; 01-24-2005 at 10:42 PM.
 
Old 01-07-2005, 05:27 AM   #11
saint_devil
LQ Newbie
 
Registered: Dec 2004
Distribution: saint
Posts: 14

Original Poster
Rep: Reputation: 0
Thanx all of you
 
  


Reply



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
graphics programmes and wacom graphics tablets? bigjohn Linux - Newbie 9 05-29-2005 05:03 PM
where to find S3 graphics pro savage DDR graphics jcolon Linux - Hardware 5 02-16-2005 04:53 PM
Graphics issues with Intel 82856G Graphics Adapter herrmag Linux - Newbie 1 08-09-2004 02:52 PM
graphics on linux.... hunter_one Linux - Software 1 08-27-2003 05:00 PM
graphics in Linux Nicksan Linux - General 16 07-04-2003 12:39 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:28 PM.

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