PDA

View Full Version : OpenGL 2.0+ on Linux?



aviel
05-26-2011, 10:00 PM
So, the standard libgl1-mesa-dev libraries that come with linux only have OpenGL 1.4

I want to code a custom shader. Is it possible to get some OpenGL 2.0+ libraries on Ubuntu? If so, how?

Alfonse Reinheart
05-26-2011, 10:44 PM
If you're on NVIDIA, install the NVIDIA drivers. It's been a while since I did this on Ubuntu, but the installation panel generally lets you do this.

If you're on ATI, you can install the ATI Catalyst drivers. But you can also install the open-source drivers that people have implemented. They're open source, if you're into that sort of thing, but not as good (yet?) as the Catalyst drivers.

aviel
05-26-2011, 11:29 PM
I have installed the proper drivers, but #include <GL/glut.h> still gives me an old version.

ZbuffeR
05-26-2011, 11:50 PM
For glut, install freeglut-dev, this is different from GL.
Then, how do you know the Gl version ?
To access modern GL features, use a library like GLEW unless you really understand the difference between an ABI and an API.

aviel
05-27-2011, 09:39 AM
I know that it's an old version because, when I looked at gl.h it only had

#define version_1_4 1
(not anything higher than that) and because OpenGL would recognize the command glLoadShader()

But when I get back to the computer I'll try installing freeglut-dev

Alfonse Reinheart
05-27-2011, 09:49 AM
That's just the header. You still have to load function pointers for higher OpenGL versions. Download and use GLEW.

aviel
05-28-2011, 03:19 AM
Isn't GLEW for extensions? glLoadShader() comes build in to any version higher than 1.4

Alfonse Reinheart
05-28-2011, 09:14 AM
Isn't GLEW for extensions?

No. (http://www.opengl.org/wiki/Getting_started#Accessing_OpenGL_functions)

kyle_
05-28-2011, 01:29 PM
Isn't GLEW for extensions? glLoadShader() comes build in to any version higher than 1.4
Since you are on Linux and using nvidia driver, you dont really need to use GLEW to load anything.

Just do:


#define GL_GLEXT_PROTOTYPES
#include <GL/gl.h>
#include <GL/glext.h>

And link to libGL.so

Its still a good idea to use some kind of loader (GLEW or your own) in production code, as you can react to extensions being unavailable.

NeuroFuzzy
05-29-2011, 12:22 AM
also, just sayin', you can check the version number with the "glxinfo" command, so, the command "glxinfo | grep version" shows:

[user@computer ~]$ glxinfo | grep version
server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
OpenGL version string: 3.3.0 NVIDIA 270.41.19
OpenGL shading language version string: 3.30 NVIDIA via Cg compiler

animesh
12-27-2011, 12:13 AM
can anyone plz help in installing open gl in ubuntu 11.04
its very urgent for my project.
i am stuck with it for nearly a month.
i have ati graphics card.

plz tell me what all libraries and drivers needed to be inatalled.
and how to install them.
plz note that i am a new linux user.
plz reply fast ..
just very very urgent.

thank you.
thanks a lot, a ton.

thokra
12-27-2011, 02:12 AM
Everything to run GL apps up to OpenGL 2.1 already comes with Ubuntu 11.04:

a) Mesa
b) the Xorg radeon driver and kernel module

Run glxinfo from a console and see what it reports.

If you want to develop a GL app under Ubunut, open a console and type in 'apt-get install libglew1.5-dev'.

There you go.

animesh
12-27-2011, 02:38 AM
thanks for your help
but its not solving my purpose.

actually, i am writing a program in c which will need opengl to draw few lines.

i have tried many ways installing various packages, but didnt got opengl installed..

can u plz guess whats the problem and show me some way...

thanks.

thokra
12-27-2011, 03:54 AM
I think you've got some things mixed up. You don't install OpenGL. You install OpenGL capable drivers which provide an implementation of the OpenGL specification.

When you develop something using an OpenGL implementation, you need to either get functions pointers of the GL functions you need, or you use a library like GLEW.

Please tell us exactly what you do. What does glxinfo report? (Please omit the huge table, only thetop part with text and version numbers etc. is important)