LinuxQuestions.org
Visit Jeremy's Blog.
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 03-09-2008, 06:16 AM   #1
almon
Member
 
Registered: May 2007
Location: india
Distribution: ubuntu7
Posts: 73

Rep: Reputation: 15
graphics in linux


Well what I have to do is to implement simple graphics algo.The algo which are used to draw basic figures (like line,circle,polygon) etc.
we have basic algo for drawing them ie bresharhams algo,dda algo.

In windows we simply include <graphics.h> file and do our work. but in linux how should do that?? I m unable to use commands like setpixel etc

anyone pls help
 
Old 03-09-2008, 06:26 AM   #2
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
You've asked this before, in exactly the same words:
http://www.linuxquestions.org/questi...-linux-623949/
... in what way were the replies you received last time inadequate?

If you don't like the answers you get, refine the question. Repeating the exact same mistakes as before only tells us you are unwilling to learn or accept advise. Therefore, why should anyone try to help?
 
Old 03-09-2008, 07:02 AM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Other thread reported for move to /Programming and merge with this one. (Anyone can ask for that or closing duplicate threads using the report button)
 
Old 03-09-2008, 07:15 AM   #4
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
Install a graphics library. SDL sounds like it might be the best choice for you, it will allow you to access the raw graphics data so you can draw using whatever algorithm you want.
 
Old 03-09-2008, 08:29 AM   #5
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
I think OP was put off the idea of having to write code to open a window to draw the graphics in. If so, then the ideal solution would be something that does this automagically - a-la OPs experiences with turbo-c++.

Can someone be reassuring on this point?
There are lots of libs - it must be bewildering.
 
Old 03-09-2008, 10:20 AM   #6
gearoid_murphy
Member
 
Registered: Mar 2006
Location: Ireland
Distribution: Debian Etch
Posts: 72

Rep: Reputation: 18
try using opengui : http://www.tutok.sk/fastgl/. Download the tarball and look in the examples directory for opening a window and drawing basic graphics. Its relatively simple.
 
Old 03-09-2008, 11:13 AM   #7
almon
Member
 
Registered: May 2007
Location: india
Distribution: ubuntu7
Posts: 73

Original Poster
Rep: Reputation: 15
well I am ver much sorry that i repeated my question.actually I founded the programming related topics in this forum which i never saw b4 so i thought i may get better answers here...
 
Old 03-09-2008, 04:23 PM   #8
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
Simon Bridge: getting a window in SDL is simple enough, without checking for errors its only a few lines:
Code:
#include <SDL/SDL.h>

int
main (argc, argv)
  int argc;
  char** argv;
{
    SDL_Surface* window;
    SDL_Init (SDL_INIT_VIDEO | SDL_INIT_TIMMER);
    // 400x320 sized window, color depth of 32
    window = SDL_SetVideoMode (400, 320, 32, SDL_SWSURFACE);
    // place draw code here (window->pixels stores the pixel data you can alter)
    SDL_Flip (window); // call to update the window after drawing to it
    SDL_Delay (10000); // admire the window for 10 seconds
    return 0;
}
 
Old 05-16-2008, 11:55 AM   #9
josedsilva
LQ Newbie
 
Registered: Apr 2002
Location: Goa, India.
Posts: 23

Rep: Reputation: 15
You could try using a graphics package like svgalib (http://svgalib.org)
It uses a cool library vgagl which has most of the pixel rendering function. svgalib will work in console mode (i.e. without starting X server).
If you want a still more simplified svgalib helper graphics package, you can mail me at josedsilva@yahoo.com
If you are looking for a graphics package under X, try SDL or Open GL, GLUT, etc.
 
  


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
Sound and Graphics not working in Intel D101GGC with ATI graphics and Realtek audio sanu1 Linux - Hardware 2 12-28-2008 07:29 PM
LXer: Xi Graphics, Inc. Releases Graphics Drivers for ATI FireMV Cards LXer Syndicated Linux News 0 09-27-2006 09:54 PM
Intel Extreme Graphics 865GBF graphics driver _UnPrEdictAbLe_ Linux - Hardware 3 07-31-2006 01:48 AM
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

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

All times are GMT -5. The time now is 09:16 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