Hi Ulrich ,

I tried to resolve the problem with minimal changes in my submission.

I agree to the thought of completely avoiding manual memory management. Is the 
following portable over different stl implementations?

std::vector<GLint> formats;
formats.reserve(numFormats);
glGetIntegerv(GL_SHADER_BINARY_FORMATS, &formats[0]);

The problem is that the elements have to use consecutive memory as the method 
requires a pointer to a GLint array. I found hints that many stl 
implementations write elements of vectors into a consecutive area of memory. 
But I'm not quite sure.

With this solution the delete calls would be obsolete, when leaving the method 
the std::vector is destroyed.

How would you use auto_ptr? As far as I discovered, an auto_ptr holds one 
element. The call to glGetIntegerv needs a consecutive array. You would need to 
create an array of auto_ptr which would lead to much overhead to just iterate 
over the available binary formats.


Cheers,
Johannes

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=37192#37192





_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to