LinuxQuestions.org
Review your favorite Linux distribution.
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
 
LinkBack Search this Thread
Old 03-08-2009, 12:19 PM   #1
FragBoog
LQ Newbie
 
Registered: Mar 2009
Posts: 4

Rep: Reputation: 0
Is it possible to retrieve an opengl context from *nix the command line?


Hi all,

I am struggling to find an answer or example on how opengl is linked into linux. In my past windows experience, 3d scenes are tied to pre-created win32 windows, but is this necessary on NIX platforms? Is it requiered to load an xwindow flavor in order to gain this render context?

Any links to examples or articles and the like will be much appreciated.

I realize this is a noobie question, but it felt like it fit more in the programming section than the newbie section. Thanks for your understanding.

Goal - Recently as a side project I have toyed with the notion of making a small, practically instant on computer whose sole purpose is to run one 3d graphics application. The speed and size portion seems to be a perfect fit for a flavor of linux, especially if you compile your own core and don't care about network sound, etc...

Background - New to *nix, but it seems like a worthwhile challenge. I have several years experience programming DirectX, a few years with OpenGl and a very strong C/C++ background. I am also the type who prefers to write as much from scratch as possible, and usually use graphics libraries as more pure interfaces (ex. gl rather than glut for windows.)

-FragBoog
 
Old 03-09-2009, 11:42 AM   #2
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
Quote:
Originally Posted by FragBoog View Post
Hi all,

I am struggling to find an answer or example on how opengl is linked into linux. In my past windows experience, 3d scenes are tied to pre-created win32 windows, but is this necessary on NIX platforms? Is it requiered to load an xwindow flavor in order to gain this render context?
You should search for something like "using OpenGL on X Window system".
Or just take xscreensaver package and tear apart one of OpenGL demos.
As far as I can tell contexts are created by glxCreateContext, and rest of operations are handed by other functions with "glx" prefixes (glxSwapBuffers, etc). See full reference here: http://www.opengl.org/sdk/docs/man/

Quote:
Originally Posted by FragBoog View Post
Goal - Recently as a side project I have toyed with the notion of making a small, practically instant on computer whose sole purpose is to run one 3d graphics application.
I think the simplest way to do it will be to run X server with just one application. This is because (as far as I know) ATI/NVidia proprietary drivers for OpenGL are made to be used with X.

Another option is to use Mesa3D library, but there is a problem - library works on CPU only. Which means it will be 10..50 times slower than hardware-accelerated OpenGL. This library is useful, for example, when you want to render scene with GLSL shaders on machine that doesn't have OpenGL 2.0 support, but rendering will be seriously slow when compared to hardware-accelerated OpenGL. For example, with GLSL shader speed difference will be 0.5("half") FPS (Mesa3D) vs 20..30(Hardware accelerated OpenGL), and without using shaders(fixed-function opengl) difference will be 70 FPS(Mesa3D) versus 700 FPS(Hardware Accelerated OpenGL)- on VERY simple scenes. Another problem is that Mesa3D isn't OpenGL certified, so you might run into bugs.

Anyway, I recommend to avoid all platfrom-dependant stuff and use SDL library from beginning. This way you'll be able to use OpenGL on any platform where SDL supports it. Examples can be found found in SDL documentation directory (/usr/doc/SDL-1.2.13/html on my system) once SDL is installed.

Last edited by ErV; 03-09-2009 at 11:43 AM.
 
Old 03-10-2009, 11:22 PM   #3
FragBoog
LQ Newbie
 
Registered: Mar 2009
Posts: 4

Original Poster
Rep: Reputation: 0
That's just the type of direction I was looking for. Thank you very much. =)

-FragBoog
 
Old 03-11-2009, 09:39 AM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,390
Blog Entries: 2

Rep: Reputation: 900Reputation: 900Reputation: 900Reputation: 900Reputation: 900Reputation: 900Reputation: 900Reputation: 900
Not sure if I'm interpreting your question correctly, but it sounds like you are trying to use OpenGL without an existing 'real' X server. If so, you may be able to use Xvfb, which requires no physical graphics hardware, but provides a X server interface to support X-based applications. The resulting screen graphics are accessible as a pixmap for saving to files or display on real hardware.
--- rod.
 
Old 03-14-2009, 02:17 AM   #5
FragBoog
LQ Newbie
 
Registered: Mar 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Yes, I was also wondering if it was possible to use/obtain an opengl context without loading an XWin scheme. It sounds as though what I thought of or saw as XWin is actually an Xserver/Xclient architecture, but i will need to spend time looking into this.

To use a very poor analog, I was curious if an opengl context can be obtained from Dos, without having to load Windows. In an effort to speed boot times, and avoid loading the rest of the x* stuff, i was looking towards launching my graphics app from the command line.

Xvfb sound very interesting but i need to spend more time looking into it. With luck it will fit my needs.

Thanks for your time and advice. =)
-FragBoog
 
Old 03-14-2009, 05:20 AM   #6
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
Quote:
Originally Posted by FragBoog View Post
To use a very poor analog, I was curious if an opengl context can be obtained from Dos, without having to load Windows.
Well, as you probably know, OpenGL standard doesn't deal with context at all. They are platform-dependant extensions. So if there will be OpenGL implementation for "dos", you will be able to use OpenGL there. If you really want OpenGL under dos, you could try compiling Mesa3D using djgpp - this might or might not be possible: http://www.delorie.com/djgpp/v2faq/faq10_4.html
But you still won't get hardware acceleration.

Last edited by ErV; 03-14-2009 at 05:22 AM.
 
  


Reply

Tags
context, opengl


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
retrieve a line from a file sharapchi Linux - General 9 12-03-2006 04:44 PM
Can I retrieve certificate expiry date from an openssl certificate (command line) davee Linux - Security 1 07-21-2006 10:28 AM
for loop to retrieve info and write approbiate line of code? ati Programming 2 05-07-2006 11:07 AM
Retrieve Window ID in command line.. joely2k Linux - General 3 11-26-2005 11:44 AM
Retrieve only a single line from a file rose_bud4201 Programming 4 06-22-2005 06:26 PM


All times are GMT -5. The time now is 09:48 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration