arohl / gdis

A visualization program for the display, manipulation, and analysis of isolated molecules and periodic structures
GNU General Public License v2.0
43 stars 17 forks source link

FIX for gtkglext #24

Closed ovhpa closed 5 years ago

ovhpa commented 5 years ago

This is an important fix for distributions which use a gtkglext version for which gdk_gl_font_use_pango_font have been removed.

The root of the problem was the removal of gdk_gl_font_use_pango_font which had no actual (or practical) replacement. It impacted and continue to impact several package (including ghemical until now and gabedit on some distributions, both of which I sometimes use).

I choose to use a method which involves pango + cairo writing the text onto a buffer, then draw that buffer on the screen directly using glDrawPixels. This may not be the recommended method (according to forums writing text on a texture then placing it on the screen is better) but I think it is more appropriate.

Also the openGL part of the code:

glRasterPos3f(x,y,z);
glPixelZoom( 1, -1 );
glDrawPixels(width,height,GL_BGRA,GL_UNSIGNED_BYTE,surface_data);

is close to the original:

glRasterPos3f(x,y,z); 
glListBase(font_offset);
glCallLists(strlen(str), GL_UNSIGNED_BYTE, str);

The added glPixelZoom is required because for some reason glDrawPixels draw the buffer upside-down. ^^'

However, should there be some trouble, please let me know.

PS: I'm committing this now, because we require it for the incoming workshop. PPS: I also include some minor fixing (mostly to remove some of the warning messages).

arohl commented 5 years ago

I have struggled with the

error for some time now. Will be great if it never darkens our door again!

So where is the font actually set and how do I get a list of possible fonts?

ovhpa commented 5 years ago

I think it's gone for good :D Just change the font using GDIS own interface: On menu: View/Display Properties/OpenGL/Change graphics font. display

arohl commented 5 years ago

I didn’t know that Sean implemented that! Nice!

On 10 Jun 2019, at 9:28 pm, Okadome Valencia notifications@github.com<mailto:notifications@github.com> wrote:

I think it's gone for good :D Just change the font using GDIS own interface: On menu: View/Display Properties/OpenGL/Change graphics font.