Say I had a valid program object loaded that had attached shader object to it. Can I then do the following upon shutdown of the app?
GLhandleARB po = glGetHandleARB(GL_PROGRAM_OBJECT_ARB);
I assume according to the specs that the containter program object will detach and delete all its shader objects and then the program object itself is deleted. Should the fixed pipeline be restored before calling delete? Specs are a bit fuzzy on this. Thanks.
The specs clearly state that shader objects are NOT (always) deleted when you delete a program object that contains them. That’s mostly because you can reuse shader objects in different program objects.
Edit : Here is the part out of the spec fo glDeleteObjectARB that should clear it up :
If an object to be deleted is attached to another object, it will be flagged for deletion, but it will not be deleted until it is no longer attached to any object, for any rendering context (i.e., it must be detached from wherever it was attached before it will be deleted). If an object is in use as part of current rendering state, it will be flagged for deletion, but it will not be deleted until it is no longer part of current state for any rendering context. If an object to be deleted has objects attached to it, those objects will be automatically detached but not deleted unless they have already been flagged for deletion by a previous call to glDeleteObjectARB .
So it seems I have to explicitly delete the shader objects and program object will only detach them automatically but not delete them. Btw, where does that quote you posted comes from? What version of docs? I can’t find it anywhere. My docs are bit different and don’t say that the program object will only detach its objects but not delete them. Maybe it’s in there and I missed it somehow that’s also possible. Can you point it out to me? Thanks.
Oh, one more thing I wanted to ask you and I would appreciate it if you could explain to me why is there an option of attaching multiple vertex shaders to a program object?
You can find them here : http://developer.3dlabs.com/openGL2/slapi/index.htm
@Multiple Shaders :
That’s because you can have parts of a shader in multiple shaderobjects (those parts then make a full shader, it’s kinda like the unit-concept of Delphi). So you can share parts of shaders via multiple shaderobjects with different program objects.
Ok, that makes sense. Thanks for your help.
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.