Deleting Shared Textures

Suppose I share textures between several contexts and delete the texture from one context ( the currently active one), does it get deleted from all the other contexts as well or do I need to make each context current and then delete the texture.?

Texture objects are not reference counted. If you need reference counting, you’ll have to implement that yourself.

Wrong.
wglShareLists shares the object’s name among all shared contexts.
You can only call glDelete once on the name.
It will finally be deleted as soon as no context has bound it any longer.

What happens when you have 2 contexts (no sharing yet), and in each you have a texture with ID=5,

then you call wglShareList.

I guess you should call wglShareList from the beginning to avoid the problem.

Originally posted by V-man:
[b]What happens when you have 2 contexts (no sharing yet), and in each you have a texture with ID=5,

then you call wglShareList.

I guess you should call wglShareList from the beginning to avoid the problem.[/b]

The docs says :

The hglrc2 parameter should not contain any existing display lists when wglShareLists is called.

Maybe you should also not have any texture objects defined? I guess it ought to fail, but I wouldn’t like to guarantee it