Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: How can I zoom Text

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2009
    Posts
    4

    How can I zoom Text

    Hi I use OpenGL with Jogl. I want to zoom text. I try to do it by changing glOrtho parameters in 2D but it does not. How can I do it.

  2. #2
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: How can I zoom Text

    When you call glOrtho you set an orthogonal projection, that means that whatever the distance between an object and the eye, it will always be rendered with the same size. To simulate a zoom effect you may need to set perspective projection and change de field of view (see glFrustum).

  3. #3
    Senior Member Regular Contributor
    Join Date
    Feb 2002
    Posts
    374

    Re: How can I zoom Text

    Instead of using perspective you can just scale the text, of course.

  4. #4
    Member Newbie
    Join Date
    Sep 2008
    Location
    Brazil
    Posts
    40

    Re: How can I zoom Text

    Hi,

    I guess scaling wouldn't work... Because, as far as I know, the image size is specified in pixels and not in size. The same would go for lines and points. In these two, you need to specify the size with a call to glLineWidth() or glPointSize().

    In the end, wouldn't it depend on what you are using to render the text?

  5. #5
    Junior Member Newbie
    Join Date
    Jan 2009
    Posts
    4

    Re: How can I zoom Text

    I change glOrtho and write text below but it does not zoom. How can I do it. Please write sample code




    /// Change Ortho
    float zoom = 1.0f/(zoomResult/100);
    float w = 0.5f * width * zoom;
    float h = 0.5f * height * zoom;
    gl.glMatrixMode(GL.GL_PROJECTION);
    gl.glLoadIdentity();
    gl.glOrtho(-w, w, h, -h, -1000, 1000);

    // write Text
    gl.glRasterPos2i(500, 500);
    glut.glutBitmapString(GLUT.BITMAP_TIMES_ROMAN_24, "Hello");

  6. #6
    Member Contributor
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    60

    Re: How can I zoom Text

    Code :
    // write Text
    gl.glRasterPos2i(500, 500);
    glut.glutBitmapString(GLUT.BITMAP_TIMES_ROMAN_24, "Hello");


    ok that do NOT work. You using Bitmap fonts. The Bitmap is like stamp in the Framebuffer. 1:1. 1 Pixel in Bitmap -> 1 Pixel in Frambuffer.
    IMO there is no posibility to Scale this type of text.

    Use Texture Text or 3D Texte instead.

  7. #7
    Senior Member Frequent Contributor _NK47's Avatar
    Join Date
    Mar 2008
    Posts
    574

    Re: How can I zoom Text

    for blitting pixels directly use glPixelZoom to control it.

  8. #8
    Junior Member Newbie
    Join Date
    Jan 2009
    Posts
    4

    Re: How can I zoom Text

    How can I use 3D or Texture Text ,Can yuo give an example

  9. #9
    Member Contributor
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    60

    Re: How can I zoom Text

    _NK47: are you shure?
    IMO PixelZoom is PixelTransfer state but Bitmap do not run over PixelTransfer.

    validatoreb:
    http://nehe.gamedev.net/lesson.asp?index=03
    http://nehe.gamedev.net/lesson.asp?index=04

  10. #10
    Senior Member Regular Contributor Rosario Leonardi's Avatar
    Join Date
    Aug 2008
    Location
    Italy
    Posts
    356

    Re: How can I zoom Text

    Download this program -> http://www.angelcode.com/products/bmfont/
    Generate a texture with the font.
    Parse the font descriptor file.
    Draw a quad for every character.

    You can find some tutorial on the site.
    ~ ~ I tell you, realtime 3D is made of blood, sweat and screams! ~ ~

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 0
    Last Post: 01-06-2015, 09:42 AM
  2. Zoom In, Zoom Out, Pan using Mouse
    By VishwaSwamiG in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 02-16-2014, 11:09 PM
  3. Change zoom from dolly to "real" zoom
    By Rainer Wahnsinn in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 02-01-2013, 05:48 PM
  4. zoom in and zoom out with gl4java and Java
    By vamsee kanth in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 12-03-2004, 02:32 AM
  5. Replies: 0
    Last Post: 03-15-2001, 02:41 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