Results 1 to 3 of 3

Thread: Deleting VBO and VAO soon after drawing

  1. #1
    Newbie Newbie
    Join Date
    May 2014

    Deleting VBO and VAO soon after drawing

    In my render loop, I'm creating a VBO and VAO for some object I'll be drawing. In one particular instance the object will only be temporary (it's the same code for whether it's temporary or not), so drawn after creating those two objects and then deleted soon after (all within the same render loop). I'm wondering what the behaviour is for this kind circumstance? I would've thought the referenced made by the draw call would've kept the objects alive, regardless of if I deleted them myself. But my application doesn't seem to render it correctly when it does this (the object doesn't get drawn at all).

    e.g. On the one particular case my render loop looks like this:
    enter render loop
    do some drawing
    {//draw this particular object
    create vbo with data for that object
    create vao for state that is used to setup when drawing that object
    draw object
    delete object (vao and vbo)
    do some drawing
    exit render loop

    Typically it normally keeps those objects alive for awhile (many render loops), and so this problem isn't apparent.

    So is it correct behaviour for OpenGL not to keep those objects alive? And so I have to change it so the object won't be deleted till the next frame, or flushing the commands, etc.

    Update: Actually I just tried flushing it (tried finishing too), and still same problem. Only works if I postpone the deletion till the next render loop.

  2. #2
    Senior Member OpenGL Pro Ilian Dinev's Avatar
    Join Date
    Jan 2008
    Watford, UK
    It's not correct behaviour, so I think it's a driver bug . If you're using a GeForce, try disabling "multithreaded optimisations" from the nvidia control panel.

    When deleting a buffer, it will get unbound only from the currently-bound VAO. I suggest you try first deleting the VAO, then VBO; but this is just a hack.
    When deleting a buffer or anything, the GL spec dictates that for external purposes, the object names get instantly deleted, but internally, the data backing them should remain alive until the GPU finishes using it.

  3. #3
    Newbie Newbie
    Join Date
    May 2014
    Yeh I thought so (about how deletions are handled). Also deleting the VAO first then the VBO worked, thanks. I guess I'll just have to file a bug report and wait for a proper fix.

Similar Threads

  1. Drawing a sphere and recoloring and/or deleting it
    By LReiter in forum OpenGL: Basic Coding
    Replies: 7
    Last Post: 09-26-2013, 08:00 AM
  2. deleting object
    By prashun in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 03-30-2011, 12:44 PM
  3. Deleting Shared Textures
    By dodo in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 11-05-2003, 10:55 AM
  4. Deleting an object
    By Suf in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 07-26-2002, 04:11 AM
  5. Deleting Textures
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 03-05-2001, 10:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean