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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:40:42+00:00 2026-06-08T06:40:42+00:00

When I use glGenBuffers to create a VBO with a pointer to it, I

  • 0

When I use glGenBuffers to create a VBO with a pointer to it, I (think) am allocating memory. Subsequent calls to glGenBuffers should return different pointes, but what about the memory previously allocated? In the Nehe examples I didn’t see a “free memory” call… and I read that openGL is kind of a “state machine”, does this mean that if my initializeBuffers() function is called several times I don’t need to free anything and just use the glGenBuffers “as it is” ?

  • 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-08T06:40:43+00:00Added an answer on June 8, 2026 at 6:40 am

    For any glGenBuffers call you do, you have to do a corresponding glDeleteBuffers call.

    Note that the pointer you pass to glGenBuffers is not allocated/deallocated. In fact, it could even be these calls do not actually allocate anything in cpu memory, but you have no guarantee of that either.

    What you pass to glGenBuffers is an already-allocated array (or single value) that will store the “name” you reference a gpu-resource by, the workflow looks like this:

    GLuint buffer; //Note: statically allocated
    glGenBuffers(1, &buffer); // Allocate a GPU-resource - only updates value in buffer
    //Work a bit with buffer
    glDeleteBuffers(1, &buffer); //Deallocate the gpu-resource
    

    The reason buffer is passed as a pointer is because you can create multiple buffers, e.g. like this:

    GLuint buffer[3]; //Note: again statically allocated
    glGenBuffers(3, &buffer); // Allocate a GPU-resource - update values in buffer
    //Work a bit with buffer
    glDeleteBuffers(3, &buffer); //Deallocate the gpu-resource
    

    Of course, buffer could very well be dynamically allocated by you, e.g.:

    std::vector<GLuint> buffer(3); //std::vector uses dynamic allocation
    glGenBuffers(3, &buffer[0]); // Allocate a GPU-resource - update values in buffer
    //Work a bit with buffer
    glDeleteBuffers(3, &buffer[0]); //Deallocate the gpu-resource
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently passing an array to a function, then attempting to use glGenBuffers with
How can this be done? This code isn't working: //////////INIT COLOR VBO FOR USE
Use: The user searches for a partial postcode such as 'RG20' which should then
Use case: we have some project meta-data files which we want tracked, but are
I'd like to lay out some things I think I've learned, but am unsure
I am trying to create a VBO for a simple rectangle. The GL is
Use of rails 3 recaptcha. In view _form.html.erb insert <%= recaptcha_tags %> But when
USE Database GO CREATE PROCEDURE FillTable @Id nvarchar(50), @ColumnNameArray nvarchar(4000), @ColumnValueArray nvarchar(4000) AS INSERT
Use Case Show a photo uploaded by the user in a square box with
use C#,want to upload excel file on google doc. bellow syntax use to upload

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.