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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:47:57+00:00 2026-05-29T11:47:57+00:00

I am working on a problem where I need to draw a progressbar and

  • 0

I am working on a problem where I need to draw a progressbar and need to calculate the length of the bar so as to display the progress on it. I am using OpenGL to draw my progressbar texture.

Can someone tell me how do I calculate the total length used by the drawing vertex buffer? Please guide.


I have my vertex buffer as following.

private float vertices[] = {
        -1.5f, -0.20f, 0.0f,        // V1 - bottom left
        -1.5f, 0.20f,  0.0f,        // V2 - top left
        1.5f, -0.20f, 0.0f,     // V3 - bottom right
        1.5f, 0.20f,  0.0f      // V4 - top right
};

In this case my texture loads inside this matrix. Can you explain how can I use calulations in my code to get width of this texture. What i’m trying to achieve here is to manipulate the vertex buffer for a progress bar on which I can show progress depending upon current value of data.

  • 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-05-29T11:47:58+00:00Added an answer on May 29, 2026 at 11:47 am

    Can someone tell me how do I calculate the total length used by the drawing vertex buffer?

    You put the data in the buffer, so you should know what’s in it. OpenGL has no concept of “object” or “width” or anything of that nature. All it knows is that you sent it some triangles to draw.

    If you want to know the “width” of the output triangles, then you’re going to have to do the transformations yourself on the CPU. Don’t read it back from the buffer object; just keep a copy manually.

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

Sidebar

Related Questions

I'm working on a problem where I need to store serialized hierarchies of Ruby
i have a problem, i'm working on a gallery php script and need help,
I just started working with OpenGL, but I ran into a problem after implementing
I'm working on an app that will need to display a coverflow style view
I have an opengl c++ project I'm working on, where I draw a player
I'm working on XNA C# when I came upon this problem where I need
I'm trying to get depth testing working correctly on OpenGL ES, using the draw_texture
I'm working on a problem where I need to have a way to convert
I'm working on problem four of Project Euler and am running into a stackoverflow
I had a problem working with the image classes in java. I am creating

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.