| [ Return to Bugs & Features | SVN ⇄ GIT ]
STR #3450
Application: | FLTK Library |
Status: | 1 - Closed w/Resolution |
Priority: | 1 - Request for Enhancement, e.g. asking for a feature |
Scope: | 3 - Applies to all machines and operating systems |
Subsystem: | OpenGL |
Summary: | Draw text with OpenGL using textures on all platforms |
Version: | 1.4-feature |
Created By: | manolo |
Assigned To: | manolo |
Fix Version: | 1.4-current (SVN: v12650) |
Update Notification: | |
Trouble Report Files:
Trouble Report Comments:
|
#1 | manolo 07:47 Jan 19, 2018 |
| The attached patch gives FLTK 1.4 the ability to draw text under OpenGL using textures, if the hardware supports GL_EXT_texture_rectangle.
Benefits are: - antialiased text (requires Xft under X11 platform) - full Unicode support (requires Xft+Pango under X11 platform) - cross-platform implementation of the texture approach to text drawing.
The new static member function Fl::draw_GL_text_with_textures(0); allows to deactivate text drawing with textures, if desired. | |
|
#2 | AlbrechtS 11:34 Jan 26, 2018 |
| Probaby related: STR #3440.
http://www.fltk.org/str.php?L3440 | |
|
#3 | alpopa 12:09 Jan 27, 2018 |
| Does the patch work with FL_OPENGL3 ? | |
|
#4 | manolo 14:01 Jan 27, 2018 |
| Q: Does the patch work with FL_OPENGL3 ?
No. The patch uses glBegin()/glEnd(), that is, follows the OpenGL 1 logic.
Contribution welcome to devise an API adequate for OpenGL3 and its shaders logic. | |
|
#5 | AlbrechtS 11:21 Feb 05, 2018 |
| I updated the patch to svn-current (r12646) and compiled it under Linux. It worked flawlessly with Xft + Pango, but it failed if configured w/o Pango (using CMake). I'm aware that the result would not be the same w/o Pango, but it should compile and link.
Other than that: looks good under Linux with xft + Pango.
Updated patch file: see GLtextureV3_r12646.patch
I didn't try to investigate the error (no member named 'font' in 'Fl_Font_Descriptor') but I hope my updated patch file helps.
Full compiler error message(s):
../../src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx:735:40: error: no member named 'font' in 'Fl_Font_Descriptor' XftTextExtents32(fl_display, desc->font, (XftChar32 *)buffer, n, extents); ~~~~ ^ ../../src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx:740:52: error: no member named 'font' in 'Fl_Font_Descriptor' if (font_descriptor()) return font_descriptor()->font->ascent + font_descriptor()->font->descent; ~~~~~~~~~~~~~~~~~ ^ ../../src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx:740:86: error: no member named 'font' in 'Fl_Font_Descriptor' if (font_descriptor()) return font_descriptor()->font->ascent + font_descriptor()->font->descent; ~~~~~~~~~~~~~~~~~ ^ ../../src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx:745:52: error: no member named 'font' in 'Fl_Font_Descriptor' if (font_descriptor()) return font_descriptor()->font->descent; ~~~~~~~~~~~~~~~~~ ^ ../../src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx:759:38: error: no member named 'font' in 'Fl_Font_Descriptor' XftTextExtents32(fl_display, desc->font, str, n, &i); ~~~~ ^ ../../src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx:819:55: error: no member named 'font' in 'Fl_Font_Descriptor' XftDrawString32(draw_, &color, font_descriptor()->font, x+offset_x_*scale_+line_delta_, y+offset_y_*scale_+line_delta_, (XftChar32 *)buffer, n); ~~~~~~~~~~~~~~~~~ ^ ../../src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx:861:53: error: no member named 'font' in 'Fl_Font_Descriptor' XftDrawString32(draw_, &color, font_descriptor()->font, x+offset_x_*scale_+line_delta_, y+offset_y_*scale_+line_delta_, (FcChar32 *)str, n); ~~~~~~~~~~~~~~~~~ ^ ../../src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx:1042:26: error: no member named 'font' in 'Fl_Font_Descriptor' fl_xftfont = (void*)f->font; ~ ^ 8 errors generated. | |
|
#6 | manolo 12:56 Feb 05, 2018 |
| Attached GLtextureV4.patch restores building without pango and is against the latest code in the svn repository, r.12646. | |
|
#7 | AlbrechtS 14:44 Feb 05, 2018 |
| Thanks for the update - tested and works.
MinGW: OK Visual Studio 2015: OK Cygwin: OK with the small patch attached Ubuntu 1604 (Xft): OK Ubuntu 1604 (Xft + Pango): OK
Uploaded patch GLtextureV4_cygwin.patch must be applied after GLtextureV4.patch and uses the same cast used with Xft w/o Pango. | |
|
#8 | AlbrechtS 14:52 Feb 05, 2018 |
| FYI: currently we can only support Cygwin with X11 (needs Cygwin dll). There's no <Cygwin + GDI> configuration unless you use "cross compilation" with native MinGW or MinGW-w64 compilers. | |
|
#9 | AlbrechtS 10:01 Feb 06, 2018 |
| +1 for both (combined) patches: GLtextureV4.patch + GLtextureV4_cygwin.patch | |
|
#10 | manolo 07:43 Feb 07, 2018 |
| Fixed in Subversion repository. | |
[ Return to Bugs & Features ]
|
| |