Closed ovhpa closed 5 years ago
I can now see labels. Only one slight oddity; when I click on a peak, the labelled line with the (hkl) appears to the left of it
[cid:02AE2D6D-3950-457E-89F1-B58A15655D9F@fritz.box]
Is this by design?
Andrew
I don't understand what you mean, can you provide a picture? Here is how it is supposed to look: when I click on (2 -1 0) peak.
Dear Prof. Rohl,
I believe the following 2 commits will fix the "disappearing text" trouble. The issue was that I previously used
cairo
to prepare and write text over thepango_print
function (previouslygl_print_window
). On some machine/configuration, this is OK because thegdk_gl_drawable_wait_gl
andgdk_gl_drawable_wait_gdk
ensure thatcairo
andopenGL
draw will not compete. Unfortunately this calls are completely ignored on some software rendering or new configurations. Without these call,cairo
will not draw anything on the screen outside of anexpose_event
.So I resort to an old (and simple) trick: I create a buffer which I fill with text drawings, using cairo. I then blit the buffer on the screen last using
glDrawPixels
. It is the same trick that I previously used on thepango_print_world function
(previouslygl_print_world
function).The second commit fixes a problem in which setting the raster position (using the
glRasterPos
functions) to the edge of a screen will sometimes fails. I believe this is due to some rounding problem in converting the position from 2D window to 3D raster coordinate. Unfortunately, even a fraction of a pixel outside the view will invalidate the whole drawing! This is the reason for the lines:which are really just a "position to the center, then slide to the edge" trick. However, using that trick, the raster position is always valid.
There is probably a better way to achieve the same result, but I can't figure it out while staying within GTK2/GTKGLEXT.
Would you be so kind as to confirm whether labels are now correctly displayed.
Sincerely,
PS: There is a render efficiency penalty in using
glDrawPixels
but I think it is quite small, and I think equivalent to the previous state withgl_print_window
andgl_print_world
functions, minus theGdkGLExt-WARNING **: cannot load PangoFont
troubles ;) Anyway, please tell me if you see a decrease of GDIS performances.