Походу не судьба мне запилить саморисующийся текстурный атлас...

Handle seaside_img=xLoadImage("tex/Gravel01.jpg");
Handle lgrass_img=xLoadImage("tex/Grass01.jpg");
Handle dgrass_img=xLoadImage("tex/Grass02.jpg");
Handle plain_img=xLoadImage("tex/Gravel02.jpg");
Handle lmountain_img=xLoadImage("tex/dirt01.jpg");
Handle mmountain_img=xLoadImage("tex/rock01.jpg");
Handle hmountain_img=xLoadImage("tex/snow02.jpg");
Handle smountain_img=xLoadImage("tex/snow01.jpg");
Handle rock_img=xLoadImage("tex/rockn.jpg");
int width=xImageWidth(seaside_img);
megatex=xCreateTexture(width*4,width*4);
xSetBuffer(xTextureBuffer(megatex));
xDrawImage(seaside_img,0,0);
xDrawImage(lgrass_img,width,0);
xDrawImage(dgrass_img,2*width,0);
xDrawImage(plain_img,3*width,0);
xDrawImage(lmountain_img,0,width);
xDrawImage(mmountain_img,width,width);
xDrawImage(hmountain_img,2*width,width);
xDrawImage(smountain_img,3*width,width);
xDrawImage(rock_img,0,2*width);
xSetBuffer(xBackBuffer());
Handle cube=xCreateCube();
xScaleEntity(cube,20,20,20);
xPositionEntity(cube,0,20,80);
xEntityTexture(cube,megatex);
В режиме дебага рисует в релизе нет. Чяднт?