Advertisement

Linux graphic API?

Started by January 15, 2005 11:06 PM
18 comments, last by shemsuheru2064 19 years, 10 months ago
I'm a beginner to linux and I want to create my own graphical application, but I'm not sure what to use. I don't want to use any graphical environment like KDE or Gnome, I want to create a stand-alone application which will be launched from the console. Some requirements for my application would be to be able to use a resolution ranging from something like 800*600 to 1280*960, in 16/24 bits colors. It would need to work with C++. So, what should I look for to get started? I think I'll need to work with the X System, am I right? Thanks
SDL/OpenGL - requires X
SVGAlib - console
Advertisement
I don't think VGALib is what I want since it probably don't allow big resolutions and lot of colors..

OpenGL would be an idea, but, how would I initialize all the required settings and set up the video mode?
You could also look into the framebuffer.
You can use SDL to cover the platform specific stuff for you. In other words, you use SDL to get a window up (and handle input/sound/etc. if you want), and use OpenGL for rendering. I'm generalizing, of course.

For details:
SDL

About SVGAlib, The only thing I know about it is that it was used to port Quake to linux. Not sure exactly what it's capable of though.
Quote: Original post by Hedos
I don't think VGALib is what I want since it probably don't allow big resolutions and lot of colors..


The 'S' in 'SVGALib' is significant for this very reason...
My stuff.Shameless promotion: FreePop: The GPL god-sim.
Advertisement
Quote: Original post by Doc
Quote: Original post by Hedos
I don't think VGALib is what I want since it probably don't allow big resolutions and lot of colors..


The 'S' in 'SVGALib' is significant for this very reason...


Does SVGALib run well on most number of modern video cards? I've never looked at it again since I met X.

OP: You may want to google for xlib if making your app X based is an option. It's pretty hard, specially the color management. You're warned.

Nice looking fonts are also a big issue. You may need to google for freetype2 too.
[size="2"]I like the Walrus best.
Quote: Original post by Arkainium
SDL/OpenGL - requires X

Not quite true. SDL apps can run in a framebuffer console as well. I even managed to get Alpha Centauri running in the framebuffer, which I doubt Loki Games had ever considered. SDL might support some other non-x drivers as well but www.libsdl.org seems to be down so I can't check ATM.
Stay away from SVGALib. It requires SUID executables, which is obviously bad, and it's just way out of date.

The two lowlevel ways to access graphics that can be taken seriously are X and framebuffer. However, as others have pointed out, you should really use SDL - which supports both (and more) - unless a) you're a masochist or b) you really are interested in the inner workings of the operating system (come to think of it, that's really the same as option (a) ;)).

cu,
Prefect
Widelands - laid back, free software strategy
Ooops, I didn't know the difference between SVGA and VGA.
Well, anyway, it looks out-dated for sure.
SDL might be a good idea, if it can run from the console as some of you have said, it would be perfect.

So now, I would have to decide to use SDL with X or the framebuffer?
What are the major differences between the two? Any pro/con for each choice?

This topic is closed to new replies.

Advertisement