I think there is an issue in  Image::readPixels that I noted in 2.8.x

Assume you have set the Image "packing" is set to say 4 , via 
image->setPacking(4) before this call.
glReadPixels might try and store 'too much' data into _data ( overwriting 
memory) because glReadPixels  will be expecting the pixel data is using a 
packing of 4 but allocateImage was passed a "packing" of 1 via the default 
parameter.

It certainly cause my code to crash depending on the variations of width and 
height.

void Image::readPixels(int x,int y,int width,int height,
                       GLenum format,GLenum type)
{
    allocateImage(width,height,1,format,type);

    glPixelStorei(GL_PACK_ALIGNMENT,_packing);

    glReadPixels(x,y,width,height,format,type,_data);
}

changing code to

  allocateImage(width,height,1,format,type,_packing);

seems to fix the issue.
It's pretty subtle, and may only affect some people who need a particular 
format for the image data, and maybe calling setPacking is an abuse of the API 
so this can be seen as informational only rather than a 'bug' report.

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





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to