Results 1 to 4 of 4

Thread: Draw a text in a window

  1. #1
    Guest

    Draw a text in a window

    I have a problem on drawing a text in a window.
    When I draw a text that can be completely located in a window, I have no problem at all. However, when I draw a text starting out of a window and ending in a winow, I have a problem. I can't see anything in a window. I think a part of the text must be drawn in a window.

    Anybody has a clue to fix this problem?

    J.

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jan 2002
    Location
    Kingston, Jamaica, W.I.
    Posts
    282

    Re: Draw a text in a window

    Are you using bitmap fonts. If so the starting position is determined by glRasterPos(). If the rasterposition is off screen it becomes invalid and nothing depending on raster position gets drawn until the rasterposition is set to a valid position again.

  3. #3
    Guest

    Re: Draw a text in a window

    Thanks for your reply.

    If so, what can I do to draw a text starting off screen and ending on screen?

    Change bitmap font to others?
    Manual calc to get a starting character on screen?
    ???

    J

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,068

    Re: Draw a text in a window

    One solution would be to draw the text using a texture map(see nehe.gamedev.net for example). You apply the text texture to a quad and just translate it into the screen to provide the scrolling effect also this way you can use any font.

    The other way is with the bitmap and using a text string. Just move the starting point in which you print the text from the string.

    char *My_text[]="Welcome to the machine!";

    W = 0.....!=23

    x // is the point on the string you wish to print, to give a scrolling effect.
    print first pass x=23 "!"
    next pass, print x=22,23 "e!"
    repest until you have scrolled the text on to the screen, repeat same as it goes off the screen, except start decreasing numbers.

    print_to_screen(My_text[x]);


    Originally posted by JHome4U:
    Thanks for your reply.

    off screen and ending on screen?

    Change bitmap font to others?
    Manual calc to get a starting character on screen?
    ???

    J
    [This message has been edited by nexusone (edited 04-26-2002).]

    [This message has been edited by nexusone (edited 04-26-2002).]

Similar Threads

  1. Draw GUI and text
    By Mattous in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-14-2017, 12:06 AM
  2. Text rendering class does not draw text
    By th0masr0ss in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 01-23-2015, 09:10 PM
  3. draw window text / unload shader?
    By imported_miroslav_karpis in forum OpenGL: GLSL
    Replies: 2
    Last Post: 12-08-2010, 01:57 AM
  4. Draw rotated text in OpenGL window?
    By alexei_shk in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 12-05-2005, 07:07 AM
  5. draw text on top-left corner of window
    By cyan in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 12-03-2002, 09:28 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean