Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: What happens to bindings of a destroyed object?

  1. #1
    Intern Newbie
    Join Date
    Jul 2009
    Posts
    38

    What happens to bindings of a destroyed object?

    Let's say I created a texture and its ID is 1. Now I bind this texture to a framebuffer with glFramebufferTexture2D.
    Now let's say that at some point in runtime I destroyed this texture and created another one, which also has ID equal to 1.
    Question: what happens to the binding I made when called glFramebufferTexture2D? I doubt that now this second texture (which has ID = 1 just like the first texture had) is bound to the framebuffer? Or is the binding in a "wrong state" since the first texture has been destroyed?

  2. #2
    Member Regular Contributor
    Join Date
    Aug 2008
    Posts
    454
    Read the chapter "Shared Objects and Multiple Contexts" in the OpenGL spec. In particular, section 5.1.2 - Automatic Unbinding of Deleted Objects:
    Quote Originally Posted by OpenGL4.3_Compatibility_spec
    When a buffer, texture, or renderbuffer object is deleted, it is unbound from any
    bind points it is bound to in the current context, and detached from any attachments
    of container objects that are bound to the current context, as described for Delete-
    Buffers, DeleteTextures, and DeleteRenderbuffers. If the object binding was
    established with other related state (such as a buffer range in BindBufferRange
    or selected level and layer information in FramebufferTexture or BindImage-
    Texture), that state is not affected by the automatic unbind. Bind points in other
    contexts are not affected. Attachments to unbound container objects, such as deletion
    of a buffer attached to a vertex array object which is not bound to the context,
    are not affected and continue to act as references on the deleted object, as described
    in the following section.
    and section 5.1.3 Deleted Object and Object Name Lifetimes

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •