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

  • Home
  • SEARCH
  • 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 8149049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:46:17+00:00 2026-06-06T14:46:17+00:00

Here’s the basic situation: I have an OpenGL VBO that draws a 2D symbol

  • 0

Here’s the basic situation: I have an OpenGL VBO that draws a 2D symbol (e.g., a polygon or a line strip, or whatever–essentially a simple sprite). I’ve defined the vertices around the origin (0, 0) and such that I will get the desired symbol size in screen pixels.

My current scene has been translated and scaled and ortho-projected to show a particular region of the model. I now want to draw the symbol such that it is centered at a specific model location but not scaled with the model (i.e., draws to the screen pixel size as defined in the VBO). I’d prefer to do this without having to programmatically re-fill the vertex buffer for the symbol (i.e., I’d like to use translation and/or scaling to draw the symbol in screen pixels but at the desired location–which is defined in “model” coordinates).

A simple example: A map using longitude and latitude is displayed and the user has panned and zoomed to a specific area of the world. The user clicks on a site of interest, and I want to show a “star” at that point. The star will pan with the map but remain the same size as the user zooms in or out. So at any point I know where (in longitude, latitude coordinates) to “center” the star and I have a VBO defined (in pixel coordinates) for a star of the desired size (centered around an origin).

So, what is the “best” way to render the “unscaled” symbol/sprite in this case?

I think I have an idea of where to go with this, but (1) I’m not sure if the approach is quite right and (2) It doesn’t seem to work as I expect it to. Here’s some pseudo-code for my general idea:

void DrawSymbol()
{
    ...
    [Not Shown: Determine the screen coordinates of the symbol's desired model location]

    gl.MatrixMode(GL_PROJECTION);
    gl.PushMatrix();    // Store the current projection
    gl.LoadIdentity();  // Set projection to identity (no projection)

    gl.MatrixMode(GL_MODELVIEW);
    gl.PushMastrix();   // Store the current model view (was scaled and translated)
    gl.LoadIdentity();  // Set model view matrix to identity (1-to-1 with screen coords)

    [Not Shown: Translate the model view so that the origin is at the desired screen coordinate found above]

    [Not Shown: Draw the VBO for the symbol] // should draw to raw screen pixels, right?

    gl.MatrixMode(GL_MODELVIEW);
    gl.PopMatrix();     // Set model view matrix to previous value -- should only effect any future renders, right?

    gl.MatrixMode(GL_PROJECTION);
    gl.PopMatrix();     // Set projection matrix to previous value -- again, should only effect any future renders, right?
    ...
}

I’ve tried this (actually, I tried it by directly rendered a simple LineStrip at the desired screen location rather than using a translated VBO–just for testing) and it didn’t seem to work. Don’t know why, though. Does the approach seem sound?

Suggestions?

  • 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-06T14:46:17+00:00Added an answer on June 6, 2026 at 2:46 pm
    1. With your 3D projection set, project the 3D coordinate to screen coordinates.
    2. Now set up a ortho projection that maps 1:1 with screen pixels and use the window coordinates determined in 1. to draw the screen-space object.

    Now, whatever the zoom or perspective of the scene, the 2D object will remain at the same size and orientation.

    Hope this helps!

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

Sidebar

Related Questions

Here's the basic setup: I have a thin bar at the top of a
Here is the problem that I am trying to solve. I have two folders
Here is my code (Say we have a single button on the page that
Here's a basic regex technique that I've never managed to remember. Let's say I'm
Here is the issue I am having: I have a large query that needs
Here's my scenario - I have an SSIS job that depends on another prior
Here's my situation: I have a Data Template set up which contains a ToggleButton
Here is the problem: I have a requirements.txt file that looks like: BeautifulSoup==3.2.0 Django==1.3
Here is the Javascript I currently have <script type=text/javascript> $(function() { $('.slideshow').hover( function() {
Here is my problem : I have a post controller with the action create.

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.