コード例 #1
0
        // super methods
        public override bool initWithTotalParticles(uint numberOfParticles)
        {
            if (base.initWithTotalParticles(numberOfParticles))
            {
                m_pVertices = new ccPointSprite[this.TotalParticles];

                if (null == m_pVertices)
                {
                    CCLog.Log("cocos2d: Particle system: not enough memory");
                    return(false);
                }

                for (int i = 0; i < this.TotalParticles; i++)
                {
                    m_pVertices[i] = new ccPointSprite();
                }

                //#if CC_USES_VBO
                //        glGenBuffers(1, &m_uVerticesID);

                //        // initial binding
                //        glBindBuffer(GL_ARRAY_BUFFER, m_uVerticesID);
                //        glBufferData(GL_ARRAY_BUFFER, sizeof(ccPointSprite)*m_uTotalParticles, m_pVertices, GL_DYNAMIC_DRAW);
                //        glBindBuffer(GL_ARRAY_BUFFER, 0);
                //#endif
                return(true);
            }
            return(false);
        }
コード例 #2
0
	    // super methods
        public override bool initWithTotalParticles(uint numberOfParticles)
        { 
            if(base.initWithTotalParticles(numberOfParticles) )
	        {
		        m_pVertices = new ccPointSprite[this.TotalParticles];

                if (null == m_pVertices)
                {
                    CCLog.Log("cocos2d: Particle system: not enough memory");
                    return false;
                }

                for (int i = 0; i < this.TotalParticles; i++)
                {
                    m_pVertices[i] = new ccPointSprite();
                }

        //#if CC_USES_VBO
        //        glGenBuffers(1, &m_uVerticesID);

        //        // initial binding
        //        glBindBuffer(GL_ARRAY_BUFFER, m_uVerticesID);
        //        glBufferData(GL_ARRAY_BUFFER, sizeof(ccPointSprite)*m_uTotalParticles, m_pVertices, GL_DYNAMIC_DRAW);
        //        glBindBuffer(GL_ARRAY_BUFFER, 0);
        //#endif
		        return true;
	        }
	        return false;
        }