nV News Forums

 
 

nV News Forums (http://www.nvnews.net/vbulletin/index.php)
-   General Linux (http://www.nvnews.net/vbulletin/forumdisplay.php?f=27)
-   -   setting up OpenGL in Linux. (http://www.nvnews.net/vbulletin/showthread.php?t=82310)

akshay_blitz 12-13-06 06:22 AM

setting up OpenGL in Linux.
 
I am trying to start 3D graphics programming on Linux, openSUSE 10.2 to be precise but have not found any tutorials to set up openGL libraries in linux.
I know its possible but I just can't do it somehow.

I read up about SDL and how its similar to openGL and about MESA but I couldn't make much use of that.
I have already got my nVidia 6800GS fully configured with the latest 96.31 drivers from nVidia.
I checked up many openGL ebooks but they all start with setting up openGL windows in windows, even on http://nehe.gamedev.net/ I found nothing I could use :(

So if someone could help me with this or even links to what I want to do that be real nice

Thanks :)

Thunderbird 12-13-06 12:54 PM

Re: setting up OpenGL in Linux.
 
The nehe tutorials show how to use GLX / SDL on linux. Just download the GLX or SDL version of the tutorial (there are dozens of different downloads of each tutorial).

akshay_blitz 12-13-06 08:46 PM

Re: setting up OpenGL in Linux.
 
Quote:

Originally Posted by Thunderbird
The nehe tutorials show how to use GLX / SDL on linux. Just download the GLX or SDL version of the tutorial (there are dozens of different downloads of each tutorial).

Hey thanks for this !
I don't know how I did'nt see the GLX Base Code @ nehe :P

But is there not a SINGLE standard for openGL in the X windows System ...I know its open source so thers no hard and fast rule but still in terms of speed what do most prefer......I mean I came across 4 extensions to openGL for the X windows System:

SDL
GLX
GLUt
Mesa3d

Which is better in terms of speed out of all these ????

Speed is my primary concern now that I have all their Base Codes working

thanks for this Thunderbird :)

Thunderbird 12-14-06 12:33 PM

Re: setting up OpenGL in Linux.
 
There are two different (actually more) OpenGL libraries for Linux. One is the libGL.so from Mesa which can be used for software rendering and which is used by most DRI drivers (radeon, intel, ..). Then you have the opengl libraries from Nvidia which ofcourse only work for Nvidia cards.

The 'standard' way for using OpenGL on Linux is by using X and glX calls (GLX is similar to WGL on Windows). When you use X/glX stuff your program is in general limited to UNIXes. For this reason lots of people use either glut or SDL for setting up OpenGL. These libraries abstract away the X/GLX stuff in a platform independant way.

akshay_blitz 12-14-06 12:43 PM

Re: setting up OpenGL in Linux.
 
Quote:

Originally Posted by Thunderbird
There are two different (actually more) OpenGL libraries for Linux. One is the libGL.so from Mesa which can be used for software rendering and which is used by most DRI drivers (radeon, intel, ..). Then you have the opengl libraries from Nvidia which ofcourse only work for Nvidia cards.

The 'standard' way for using OpenGL on Linux is by using X and glX calls (GLX is similar to WGL on Windows). When you use X/glX stuff your program is in general limited to UNIXes. For this reason lots of people use either glut or SDL for setting up OpenGL. These libraries abstract away the X/GLX stuff in a platform independant way.

Cheers :)
Thanks mate !
you have made the decision for me......I am sure that I will be using GLUT ......

lunix 12-15-06 12:01 PM

Re: setting up OpenGL in Linux.
 
I have been using SDL to great effect developing GL apps on both WIN32 and Linux platforms.

akshay_blitz 12-15-06 01:45 PM

Re: setting up OpenGL in Linux.
 
Quote:

Originally Posted by lunix
I have been using SDL to great effect developing GL apps on both WIN32 and Linux platforms.

Well.........
I was beginning to wonder if I should go ahead with GLUT because I know SDL is in a way better than GLUT because it allows you access to audio as well.
But at the moment I just want to familiarize myself with openGL using the GLUT library but yeah using SDL later is very much on my mind.
So I will check out some SDL tutorials from the NeHe website later when I am comfortable with using GLUT .

Anyways I used this this HOW-TO to install GLUT
http://www.linux.com/howtos/Nvidia-O...instglut.shtml
.
.
.
he problem is I dont know how to start on my first program.
Now that my GL and GLU header files are where I want them..........should I follow any tutorial for openGL.

.
.
.
The tutorials available at NeHe are for use with windows because its code has the #include<window.h> directive.....So i was wondering how to use them with GLUT........should I just remove this header file ???????


PS: Sorry for the noobness and the bolding of the text but I desperately need some help :o

lunix 12-18-06 02:58 PM

Re: setting up OpenGL in Linux.
 
Hi again. The nehe tutorials are a good and satisfying way to get started with opengl. GLUT is crossplatform however it is obvious that the glut version of lesson 02 was written for windows. There is not very much learning associated with the various ways of aquiring a GL context you may still wish to look into SDL it will save you some hassle getting the examples to compile ;)

To get it to work in linux change the includes from:

#include <windows.h> // Standard Header For Most Programs
#include <gl/gl.h> // The GL Header File
#include <gl/glut.h> // The GL Utility Toolkit (Glut) Header

To:

#include <stdlib.h> // defines exit
#include <GL/gl.h> // The GL Header File
#include <GL/glut.h> // The GL Utility Toolkit (Glut) Header

Then change the return type of "main" from void to int tsk-tsk.

Now simply compile like so:
$ g++ lesson2.cpp -lGL -lGLU -lglut
And run like so:
$ ./a.out

tada :D


All times are GMT -5. The time now is 06:12 AM.

Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.