nkint
nkint

Reputation: 11733

Simple opengl code (render to texture) works on mac but not on ubuntu

I have a simple opengl code written in cpp in qt 4.8 for gl context, with qt-creator.

The code does some render-to-texture with FBO and then show the texture on the screen. The render-to-texture involves vertex buffer array. Then some old-school immediate render (glPushMatrix, glBegin(GL_POINTS), glVertex, etc) for debug.

In the macbookpro. no problem, code is working perfectly.

Then I have tried to port it on ubuntu. Some changes in the .pro files:

LIBS += -lglut -lGLU -lGL -lGLEW                 #linux

LIBS += -framework GLUT -framework OpenGL -lGLEW # mac

and in the headers:

// linux
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glu.h>

// mac
#include <GL/glew.h>
#include <gl.h>
#include <glu.h>

In ubuntu the immediate render works, it is showing what it has to do, but the texture are empty (both when i draw them on the screen both if I do some pixel transfer from texture buffer to QImage, and in mac everything works perfectly).

The macbookpro has a Intel HD Graphics 4000 512MB, and gl version 2.1 INTEL-8.12.47 while the Ubuntu (12.04, 3.5.0-36-generic #57~precise1-Ubuntu) machine has a GEFORCE GTX 660, and gl version 1.4 (2.1.2 NVIDIA 319.23).

I think there is some problem on gl/nvidia drivers because when I run the qt application I have this warning:

libGL error: failed to load driver: swrast
libGL error: Try again with LIBGL_DEBUG=verbose for more details.

If it worth, I'm using opengl command without _EXT suffix in the end..

I'm not practical about opengl and card capabilities and (especially) on installing driver under linux.

EDIT:

if, as suggested, I try to call glewinfo with debug verbose flag i got:

libGL: screen 0 does not appear to be DRI2 capable
libGL: OpenDriver: trying /usr/lib/i386-linux-gnu/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib/i386-linux-gnu/dri/swrast_dri.so
libGL error: failed to load driver: swrast

Upvotes: 2

Views: 1039

Answers (1)

datenwolf
datenwolf

Reputation: 162297

GEFORCE GTX 660, and gl version 1.4 (2.1.2 NVIDIA 319.23).

That basically screams that there's no proper OpenGL driver installed. The GeForce 660GTX is OpenGL-4 capable.

Make sure you have the NVidia binary drivers properly installed (the open source nouveau drivers are making progress, but they're still far behind in features and performance).

apt-get install nvidia-glx nvidia-kernel-source nvidia-vdpau-driver libgl1-nvidia-glx libglx-nvidia-alternatives

should do the trick.

Upvotes: 2

Related Questions