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 8102711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:18:56+00:00 2026-06-05T23:18:56+00:00

I need to draw 2D overlay over OpenGL scene. OpenGL is used for 2D

  • 0

I need to draw 2D overlay over OpenGL scene. OpenGL is used for 2D animation and just draws textured 2D rectangle in orthogonal projection, this is drawing code:

// viewport is set to the whole window client area
// m_fRectX, m_fRectY are computed in OnSize and define 
// sub-rectangle for image drawing
// m_nImageWidth, m_nImageHeight are texture dimensions

glClear( GL_COLOR_BUFFER_BIT );
glEnable( GL_TEXTURE_RECTANGLE_ARB );
glBegin(GL_TRIANGLE_STRIP);

glTexCoord2d(0.0f, (float)m_nImageHeight);
glVertex2d(-m_fRectX, -m_fRectY);
glTexCoord2d((float)m_nImageWidth, (float)m_nImageHeight);
glVertex2d(+m_fRectX, -m_fRectY);
glTexCoord2d(0.0f, 0.0f);
glVertex2d(-m_fRectX, +m_fRectY);
glTexCoord2d((float)m_nImageWidth, 0.0f);
glVertex2d(+m_fRectX, +m_fRectY);

glEnd();
SwapBuffers(m_hDC);

My requirements:

  1. Performance is critical.

  2. Windows-specific API is allowed.

  3. Text and image overlay (icon-style) are required.

  4. The only factor which defines overlay position and size is window client area size (which is equal to OpenGL viewport in my case).

What technique is suitable for this case?

  • 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-05T23:18:58+00:00Added an answer on June 5, 2026 at 11:18 pm

    The most performant way to draw text using OpenGL is by using Bitmap fonts. This uses little texture-mapped quads to render the text. It also has a few drawbacks though. This sort of rendering makes it hard (but not impossible) to scale up from the resolution the font texture is baked at. I like and use AngelCode’s Bitmap Font generator, but there are many tools like this one. You can choose one that fits your needs.

    Another option is to use Outline fonts. This can be sized up or down with no loss of quality, but uses wglUseFontOutlines.

    The third and hardest (but the one with best quality) would be to render the text yourself. This paper by Microsoft Research has some very cool techniques to render vector art right on the GPU. This GPU Gems article shows us how.

    There are many tradeoffs between performance, complexity and quality. It is important you understand the pros and cons of each before making a decision to use one or the other.

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

Sidebar

Related Questions

I need to draw an overlay over a datagrid cell. I want the overlay
i need some help to print a string over a opengl 3d scene. I
I need to draw vertical and horizontal rectangle / bands (like in Gantt charts)
In the game I'm developing I need this function: being able to draw on
I need to draw a string over a Infragistics toolbar, and I cannot use
I am drawing an image as overlay for MKMapview, for this I need to
I need to draw a rectange,circle and line and then animate them(press left ->
I need to draw simple alpha maps in xna which depends on current game
I need to draw a chart to show the evolution of data in real
I need to draw a lot of lines. I'm using UIBezierPath for drawing lines

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.