OpenGL & GLSL 3.3 on an HD Graphics 4000 under Ubuntu 12.04
so Ive seen a lot of threads surrounding this and I thought here would be a good place to respond. Im running Ubuntu 15.04 with intel ivybridge. After using the "Intel Graphics installer for linux" application, glxinfo gives the following info regarding openGl:
OpenGL core profile version string: 3.3 (Core Profile) Mesa 10.6.0
OpenGL core profile shading language version string: 3.30
OpenGL version string: 3.0 Mesa 10.6.0
OpenGL shading language version string: 1.30
Now from this you can see that the core profile and glsl version are 3.3,but compatible openGl is only 3.0 thus if you want your code to run with 3.3 you need to specify both an opengl core profile and a glsl core profile. The following steps should work if youre using freeglut and glew:
- the glsl #version should specify that you want the core profile:
#version 330 core
- specify you want opengl 3.3:
glutInitContextVersion (3, 3);
- and finally set glewExperimental to true before glewInit():
glewExperimental = GL_TRUE;
Edit:
Something I forgot to mention which seems to be relevant to most *nix users using freeglut is regarding depth testing,i,e what should be drawn( and what shouldn't) of a mesh from a particular view point:
To use depth testing on Linux, you not only need to enable depth testing via
(glEnable(GL_DEPTH_TEST);
but you also need to create your glut context to have a depth buffer (Windows seems to usually have a depth buffer by default, Linux doesn't).
Using freeglut that means you need to include GLUT_DEPTH
in glutInitDisplayMode so that it creates the context to have a depth buffer, e.g.
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPTH);
p.s. I have only been using freeglut because the college module I took gave us demo code to run using it. Since then I would definitely recommend switching to glfw instead. The first part of my answer still pretty much applies, just with glfw methods instead.
Great News!!!
Mesa 10 is out which means support for Opengl 3.3
and GLSL 3.3
!
This is tested on my 4th Generation Core i5 Mobile Processor with an HD 4400 Graphics chipset.
Modern OpenGL
development is now possible on integrated intel chipsets in linux! this is a huge step forward. Note that ubuntu 15.04 ship with Mesa 10.5
Here's me rendering a triangle using a GLSL 3.3 Shader :)
Ok so in order to get the experimental drivers to make this work on Ubuntu 13.10 you're going to need to do a few things:
# Note this will take awhile!
1.) Add the PPA Repository
$ sudo add-apt-repository ppa:oibaf/graphics-drivers
2.) Update sources
$ sudo apt-get update
3.) Dist-upgrade (rebuilds many packages)
$ sudo apt-get dist-upgrade
4.) Reboot!
In your code make sure you request a Opengl 3.3 context!
Run this command glxinfo | grep OpenGL
you should get something like...
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Haswell Mobile
OpenGL core profile version string: 3.3 (Core Profile) Mesa 10.1.0-devel (git-f9cfe5c saucy-oibaf-ppa)
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
Source Articles
http://www.phoronix.com/scan.php?page=news_item&px=MTQ5OTk
https://launchpad.net/~oibaf/+archive/graphics-drivers/