- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
in an attempt to recreate the useful but now defunct glutbitmapcharacter routine, I'm attempting to use the fwglUseFontBitmaps routine as described at: https://msdn.microsoft.com/en-us/library/windows/desktop/dd374392(v=vs.85).aspx
Unfortunately the code fails (okay=false, istatus = 0) when the fwglUseFontBitmaps function is called. Any ideas ?
Please ignore the font stuff - this was me starting to code up the NeHe tutorial - but since I cant get the fwglUseFontBitmaps to work I abandoned all hope.
subroutine setup_winfont(fontbase)
!
! routine to setup windows fonts for future output - based on arial font
use IFWINA
use IFOPNGL
!
integer(k_glint) :: fontbase
integer(HANDLE) :: hDC ! Device Context
integer(HANDLE) :: hRC ! OpenGL Context
integer(HANDLE) :: hWnd ! Window
integer(HANDLE) :: hinstance
integer(HANDLE),save :: hFont=0
integer(HANDLE),save :: oldFont=0
integer(HANDLE) :: hmemDC
integer font_height, istatus
logical keys(256)
logical okay
!
hmemDC = CreateCompatibleDC (hDC)
istatus= SelectObject (hmemDC, GetStockObject (SYSTEM_FONT))
write(*,*)'istatus ',istatus
write(*,*)'fontbase is ',fontbase
okay= fwglUseFontBitmaps(hmemDC, 0, 255, 1000)
write(*,*)' okay = ',okay
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try creating a display list first.
eg
integer :: fbase
fbase = fglGenLists(255)
and then refer to this in your call to fwglUseFontBitmaps(hmemDC,0,255,fbase)
Hope this helps
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is a more complete example in Norman Lawrence's book. A perhaps more complete example, but designed to be compatible with gfortran rather than ifort can be found at http://home.comcast.net/~kmbtib/Fortran_stuff/gridview.zip in the gridview.f90 file, subroutine MakeFont.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks to all who replied. I've managed to get the text to display. Here is the code in case anyone else needs it.. The winmods module is a stripped down version of the ringmods module contained in the opengl examples.
subroutine setup_winfont(iheight) ! ! routine to setup windows fonts for future output - based on arial font use IFWINA use IFOPNGL use winMods ! integer(HANDLE),save :: hFont=0 integer(HANDLE),save :: oldFont=0 integer font_height, istatus logical okay font_height=-iheight ! use minus to get nearest character height fontbase = fglGenLists(255) hFont = CreateFont (font_height, & ! 0,0,0, & FW_NORMAL, FALSE,FALSE,FALSE, & ANSI_CHARSET, OUT_DEFAULT_PRECIS, & CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, & DEFAULT_PITCH .OR. FF_DONTCARE, & "arial") istatus = SelectObject(hDC, hfont) ! // Selects The Font We Want ! istatus= SelectObject (hDC, GetStockObject (SYSTEM_FONT)) okay= fwglUseFontBitmaps(hDC, 0, 255, fontbase) end !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! subroutine print_text(output_str,x_pos,y_pos,fontbase) ! use IFWINA use IFOPNGL ! ! routine to disply text at the position with the current font ! character*(*) output_str integer(k_glint) :: fontbase ! call fglRasterPos2f(x_pos, y_pos) call fglPushAttrib(GL_LIST_BIT) ! Pushes The Display List Bits ( NEW ) call fglListBase(fontbase) call fglCallLists(len(output_str), GL_UNSIGNED_BYTE, loc(output_str)) ! Draws The Display List Text call fglPopAttrib() ! end
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page