Off screen sprite clipping

Off screen sprite clipping
0.0 0


Are offscreen regions of sprites automatically clipped or do i need to manually set a draw rectangle?

For example, I have a large texture/sprite in my background but half of it is offscreen. Will cocos2dx/openGL ignore the offscreen pixels?

Many thanks


I believe it does not clip the large sprite. Say you have a sprite sized 960x640 and your screen size is 480x320, you’d still get 960x640 as the size of the sprite.


Thanks Lance, so in terms of rendering performance it would be better to manually clip the sprite?


If you’re not going to use the off-screen sprites then it’s better to import them already clipped. In my case, I still have use for the off-screen part of the sprite since I panning/moving them in and out of the screen.


IIRC OpenGL automatically clips viewport, but you should still uses smaller version, since it will use lower memory footprint


Thanks Hao, thats answers my question.

Lance, I’m doing something similar with scrolling backgrounds so the whole texture is needed.

Thanks again guys.