---
title: "CCSpriteBatchNode为何会提高运行效率"
author: "xiaopao"
date: "2013-03-07T20:38:58Z"
tags: []
categories: ["移动开发"]
slug: "ccspritebatchnode"
draft: false
lastmod: "2013-03-07T22:20:21Z"
id: 1825882
url: "https://xiaopao.iteye.com/blog/1825882"
---

当使用CCSprite创建N个精灵的时候，那么N个精灵都各有一张纹理，而且当OpenGL ES绘制N个精灵时，每个精灵的绘制都会调用一次OpenGL ES的draw。

但是如果将创建的N个精灵，都添加到CCSpriteBatchNode中，那么由于CCSpriteBatchNode限制所有子精灵都必须是用同一资源，所以它只有一张纹理(且N个精灵公用一张纹理)。当OpenGL ES绘制CCSpriteBatchNode中的N个精灵时，只会调用一次OpenGL ES的draw。

详见：<http://www.cnblogs.com/pengyingh/articles/2434931.html>