View Full Version : Display problems after upgrade to Ubuntu 16.04

12-04-2016, 12:14 PM

I've coded an app since several years that used to work just fine. It's an audio spectrogram in 3D. OpenGL is displayed in and SDL1.2 window that is embedded in GTK3 frame.
Untill Ubuntu 15.04 it used to work very well. i didn't test Ubuntu 15.10

Since upgrade to Ubuntu 16.04, the display has become half transparent in some parts, but still ok in some other parts of the screen; it's not usable anymore though.
This is also the case on another laptop.

I have an Intel graphic card.

I don't know where to start here


12-04-2016, 11:30 PM
I would go for this (https://developer.gnome.org/gtk3/unstable/GtkGLArea.html) which is the official OpenGL renderer for nowadays Gtk.

If you want to stick with what you did, feel free to add as much information as you can (how do you connect your SDL Window within your Gtk Widget, how do you ensure you make them talk as they should - context creation and make current is very important here). But I highly doubt that a solution will be easily found.

12-06-2016, 03:12 PM
Hello and thanks fot your reply

I initialized OpenGL this way:

glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glEnable (GL_BLEND);
gluPerspective(45, (float)2, .1, 200);

This used to work from the beginning, since 2012....

I use a window hack to put SDL in GTK; I know it's not a good way but that's the only I found at that time:

/* Hack to get SDL to use GTK window */
{ char SDL_windowhack[32];
GDK_WINDOW_XID(gtk_widget_get_window(spectrum3dGui .drawing_area)));
printf("%s\n", SDL_windowhack);

Regarding the link you sent me, I found it too. Problems are :
- I didn't find simple example since it's very new;
- it seems not possible to use functions such GlRotate, which I use

This used to work from the beginning, since 2012...
Could it be related to the new OpenGL4 API?


12-06-2016, 11:01 PM
Regarding the link you sent me, I found it too. Problems are :
- I didn't find simple example since it's very new;
- it seems not possible to use functions such GlRotate, which I use

This used to work from the beginning, since 2012...
Could it be related to the new OpenGL4 API?


The new Gtk GLArea works with GL 3 only (with few exceptions that very few people will be able to use). So yes, you won't be able to use these deprecated features anymore.

AFAIK there is no other easy solutions to do OpenGL with Gtk 3. What one can do is to change the Gtk code so that they create an "old" context so that OpenGL prior to 3 will continue to work. If you plan to release your software, this might not be a possible solution for you.

Here (https://github.com/ebassi/glarea-example) is an example that you might already have found. There is almost the same example in the official Gtk example that you can find in the sources or when installing the doc/examples on your distro.

For you hack, what I can tell you is that the Gtk 3 API is moving a lot. Reading their documentation and their code might help you.

One last thing I can tell is that I hardly discovered that I have to make the context current each time I react to a Gtk event, and this despite of the fact that Gtk manages the events in the main thread, and that GL operates in the main thread, and that I explicitly ask to create for a context in the main thread. But they make a different context current each time an event occurs...

12-07-2016, 02:11 PM

The problem is some kind of weird transparency : the front curves are transparent to everything that is drawn behind (and this is new). So I could change the code so that the back is drawn before the front. But if I turn the display (the spectrogram can be turned in every angle), the rpoblem is back, so it's only

I've old releases wich uses only SDL (no hack) : it still works perfectly. It was that way before actually, and I changed because I wanted all events managed by GDK, and a "all-in-one" display. Actually the software is released on Sourceforge (and downloaded) since 2012...
I guess I have to go back to my previous configuration : an external SDL window and a GTK GUI.

Furthermore, I'll have to migrate from SDL 1.2 to SDL2 and I think the window hack doesn't work with SDL2. Another good reason to come back to SDL only.

Just for the record, in my code, there is also a possibility to use GtkGlExt library (that was ported to GTK3) and that used to work very well. But the developpement has been stopped since at least 2 years.

In any case, thanks a lot for your answers.

12-07-2016, 11:33 PM
With hacks, one can avoid some problems, but other will arise soon or later... You can try to ensure you have depth enabled for your window. Also ensure you have an RGBA buffer.

One other thing you might want to try is to render in an FBO then blit that FBO on the screen. This might solve some of the issues since depth will be managed by the FBO and on screen you'll just display a textured full-quad...

For about gtkglext... I, quite recently, moved from Gtk 2 to Gtk 3 for some reasons. And after long weeks of deep and twisted thoughts, I preferred to move to Gtk 3/GtkGLArea instead of using a hack of gtkglext, or even to move to another toolkit (ie Qt). I had a lot of work to do in order my app to by fully compliant with GL 3 core (ie remove all the glRotate, glPushMatrix and so on). And now I believe it worth it.

So, if you want a hack, then the simple thing is: modify the gtkglarea source so that it creates an 'old' context. That will be far preferable and more maintainable than using gtkglext or any other hacks.
If you don't want a hack, then stuck with gtkglarea (this (https://www.opengl.org/discussion_boards/showthread.php/198919-Cleaning-up-my-OpenGL-program?highlight=gtk+context) might help for example).