Example #1
0
        // overriding draw method
        public override void Draw()
        {
            Debug.Assert(m_pBatchNode == null, "draw should not be called when added to a particleBatchNode");
            //Debug.Assert(m_uParticleIdx == m_uParticleCount, "Abnormal error in particle quad");

            //updateQuadsWithParticles();

            CCDrawManager.BindTexture(m_pTexture);
            CCDrawManager.BlendFunc(m_tBlendFunc);
            CCDrawManager.DrawQuads(m_pQuads, 0, m_uParticleCount);
        }
        // overriding draw method
        public override void Draw()
        {
            Debug.Assert(m_pBatchNode == null, "draw should not be called when added to a particleBatchNode");
            //Debug.Assert(m_uParticleIdx == m_uParticleCount, "Abnormal error in particle quad");

            //updateQuadsWithParticles();

            CCDrawManager.BindTexture(m_pTexture);
            CCDrawManager.BlendFunc(m_tBlendFunc);
            CCDrawManager.DrawQuads(m_pQuads, 0, m_uParticleCount);

            /*
             * CC_NODE_DRAW_SETUP();
             *
             * ccGLBindTexture2D(m_pTexture.Name);
             * ccGLBlendFunc(m_tBlendFunc.src, m_tBlendFunc.dst);
             *
             *
             #if CC_TEXTURE_ATLAS_USE_VAO
             *                                                                                      //
             * // Using VBO and VAO
             * //
             * glBindVertexArray( m_uVAOname );
             *
             #if CC_REBIND_INDICES_BUFFER
             * glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_pBuffersVBO[1]);
             #endif
             *
             * glDrawElements(GL_TRIANGLES, (GLsizei) m_uParticleIdx*6, GL_UNSIGNED_SHORT, 0);
             *
             #if CC_REBIND_INDICES_BUFFER
             * glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
             #endif
             *
             * glBindVertexArray( 0 );
             *
             #else
             *  //
             *  // Using VBO without VAO
             *  //
             *
             #define kQuadSize sizeof(m_pQuads[0].bl)
             *
             * ccGLEnableVertexAttribs(kCCVertexAttribFlag_PosColorTex);
             *
             * glBindBuffer(GL_ARRAY_BUFFER, m_pBuffersVBO[0]);
             * // vertices
             * glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, kQuadSize,
             *                    (GLvoid*) offsetof(ccV3F_C4B_T2F, vertices));
             * // colors
             * glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_UNSIGNED_BYTE, GL_TRUE, kQuadSize,
             *                    (GLvoid*) offsetof(ccV3F_C4B_T2F, colors));
             * // tex coords
             * glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, kQuadSize,
             *                    (GLvoid*) offsetof(ccV3F_C4B_T2F, texCoords));
             *
             * glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_pBuffersVBO[1]);
             *
             * glDrawElements(GL_TRIANGLES, (GLsizei) m_uParticleIdx * 6, GL_UNSIGNED_SHORT, 0);
             *
             * glBindBuffer(GL_ARRAY_BUFFER, 0);
             * glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
             *
             #endif
             * CC_INCREMENT_GL_DRAWS(1);
             * CHECK_GL_ERROR_DEBUG();
             */
        }