Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8433587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:25:39+00:00 2026-06-10T06:25:39+00:00

I’m currently exploring opengl through the use of the JOGL library (the java wrappers

  • 0

I’m currently exploring opengl through the use of the JOGL library (the java wrappers for openGL) which I’m using to create 2d/3d graphs. At the minute I’m having a little issue with text I’ve rendered through the “glutBitmapString” method, it isn’t resizing in respect of the window as shown in the screenshot below. Unfortunately the job spec I’ve been given is that this must be done in Java, so I can’t jump to any other language that has a better supported version of openGL.

Everything else in the window resizes correctly so I’m assuming the issue is in the code I’ve posted below, if not then I’ll be happy to post code you feel is relevant to the issue.

The default window size

The resized window

Here is a snippet of my code I’m using to render the text

GL gl = drawable.getGL();
    GLUT glut = new GLUT();

    float textPosx = -0.4f;
    float textPosy = -2.1f;

    gl.glColor3f(1.0f, 0.0f, 0.0f);

    // Move to rastering position
    gl.glRasterPos2f(textPosx, textPosy);

    // convert text to bitmap and tell what string to put
    glut.glutBitmapString(GLUT.BITMAP_HELVETICA_12, "0");

    textPosx = 1.75f;
    textPosy = -2.15f;

    // Move to rastering position
    gl.glRasterPos2f(textPosx, textPosy);

    // convert text to bitmap and tell what string to put
    glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18, "TIME");

    textPosx = -1.0f;
    textPosy = 1.0f;

    gl.glColor3f(0.0f, 1.0f, 0.0f);

    // Move to rastering position
    gl.glRasterPos2f(textPosx, textPosy);

    // convert text to bitmap and tell what string to put
    glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18, "ERRORS");
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T06:25:40+00:00Added an answer on June 10, 2026 at 6:25 am

    glutBitmapString draws text in 2D. 2D text size is based on font size. So, if you set the font size to 18, as you have in this example, then it will be standard 18 pt font size on the screen, no matter how large you make the window or how close you zoom in. This is not a Java issue. Java is not actually drawing anything. Everything is being drawn by the OpenGL native libraries, which are written in C++, so it will be exactly the same in C++ as it is in Java.

    There are two ways you could work around this. One would be to change the font size of the text as you zoom in or out. This would be kind of a awkward, and may be difficult to get right. A better option, imo, would be to simply use 3D text. In JOGL you use the TextRenderer object to draw 3D text.

    In your init method create a global variable like so:

    textr = new TextRenderer(new Font("SansSerif", Font.PLAIN, 18));
    

    Obviously, change the font settings to whatever you prefer. Then in your display loop:

    textr.setColor(Color.GREEN);
    textr.begin3DRendering();
    textr.draw3D("ERRORS", xLocation, yLocation, zLocation, scale);
    textr.end3DRendering();
    

    Personally, I prefer to use a large font size and then scale it down some, that way, when you zoom in, it doesn’t get pixelated.

    Also, unlike 2D text, 3D text will not always face the screen. You have to do that manually. It depends on how your camera is set up, but if you’re using basic rotations to move the camera around, usually you can just negate those rotations on the 3D text object to make it face the camera.

    For the x, y, and z locations, those are the locations within the current object (local coordinates). Think of the beginRendering() to endRendering() as one object with its own local coordinate system. Usually, I prefer to draw my text at 0, 0, 0 local coordinates, then move the entire object to the proper location. That way rotations are easier to understand.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I want use html5's new tag to play a wav file (currently only supported
I have thousands of HTML files to process using Groovy/Java and I need to
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I used javascript for loading a picture on my website depending on which small
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I would like to run a str_replace or preg_replace which looks for certain words

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.