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:
Performance is critical.
Windows-specific API is allowed.
Text and image overlay (icon-style) are required.
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?