On 11/11/10 23:26 , Aitor Ardanza wrote: > I'm trying to combine two textures, a manually created (blank) and the other > loaded > with an image. But the result is a little weird. >... > memcpy(texture->getImage(0)->data()+((i*tex_height)+j)*4 , r, 1); > memcpy(texture->getImage(0)->data()+((i*tex_height)+j)*4+1, g, 1); > memcpy(texture->getImage(0)->data()+((i*tex_height)+j)*4+2, b, > 1); > memcpy(texture->getImage(0)->data()+((i*tex_height)+j)*4+3, a, 1);
I believe your pixel address calculation is wrong; try this instead: // i==row/y, j==column/x unsigned char* pixel = texture->getImage(0)->data() + ((i * tex_width) + j) * 4; *(pixel+0) = r; *(pixel+1) = g; *(pixel+2) = b; *(pixel+3) = a; HTH, /ulrich _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

