Hi,

I am new to OpenGLES2 and wants to change part of image for a cube map texture.

for eample - I want to change middle portion of old texture to new texturedata for all the cube faces.

My code is somethig like -

GLES2_ERROR_CHECK(glTexImage2D(GL_TEXTURE_CUBE_MAP _POSITIVE_X, ilevel,eintformat,iWidth,iHeight,iBorder,eformat,e Type,TexData)); GLES2_ERROR_CHECK(glTexImage2D(GL_TEXTURE_CUBE_MAP _NEGATIVE_X, ilevel,eintformat,iWidth,iHeight,iBorder,eformat,e Type,TexData));
GLES2_ERROR_CHECK(glTexImage2D(GL_TEXTURE_CUBE_MAP _POSITIVE_Y, ilevel,eintformat,iWidth,iHeight,iBorder,eformat,e Type,TexData));
GLES2_ERROR_CHECK(glTexImage2D(GL_TEXTURE_CUBE_MAP _NEGATIVE_Y, ilevel,eintformat,iWidth,iHeight,iBorder,eformat,e Type,TexData));
GLES2_ERROR_CHECK(glTexImage2D(GL_TEXTURE_CUBE_MAP _POSITIVE_Z, ilevel,eintformat,iWidth,iHeight,iBorder,eformat,e Type,TexData));
GLES2_ERROR_CHECK(glTexImage2D(GL_TEXTURE_CUBE_MAP _NEGATIVE_Z,ilevel,eintformat,iWidth,iHeight,iBord er,eformat,eType,TexData));

GLES2_ERROR_CHECK(glTexSubImage2D(GL_TEXTURE_CUBE_ MAP_POSITIVE_X,ilevel,iXoffset,iYoffset,isubwidth, isubheight,eformat,eType,subTexData));
GLES2_ERROR_CHECK(glTexSubImage2D(GL_TEXTURE_CUBE_ MAP_NEGATIVE_X,ilevel,iXoffset,iYoffset,isubwidth, isubheight,eformat,eType,subTexData));
GLES2_ERROR_CHECK(glTexSubImage2D(GL_TEXTURE_CUBE_ MAP_POSITIVE_Y,ilevel,iXoffset,iYoffset,isubwidth, isubheight,eformat,eType,subTexData));
GLES2_ERROR_CHECK(glTexSubImage2D(GL_TEXTURE_CUBE_ MAP_NEGATIVE_Y,ilevel,iXoffset,iYoffset,isubwidth, isubheight,eformat,eType,subTexData));
GLES2_ERROR_CHECK(glTexSubImage2D(GL_TEXTURE_CUBE_ MAP_POSITIVE_Z,ilevel,iXoffset,iYoffset,isubwidth, isubheight,eformat,eType,subTexData));
GLES2_ERROR_CHECK(glTexSubImage2D(GL_TEXTURE_CUBE_ MAP_NEGATIVE_Z,ilevel,iXoffset,iYoffset,isubwidth, isubheight,eformat,eType,subTexData));

currently-iXoffset = iWidth/2 - isubwidth/2;
iYoffset = iHeight/2 - isubheight/2 ;

I am not getting the correct output on screen. I am getting the new texture not in the middle of the cube face. Am I doing something wrong in calculating the offsets?

Thanks.