您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CC_INCREMENT_GL_DRAWS函数代码示例

51自学网 2021-06-01 19:57:38
  C++
这篇教程C++ CC_INCREMENT_GL_DRAWS函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中CC_INCREMENT_GL_DRAWS函数的典型用法代码示例。如果您正苦于以下问题:C++ CC_INCREMENT_GL_DRAWS函数的具体用法?C++ CC_INCREMENT_GL_DRAWS怎么用?C++ CC_INCREMENT_GL_DRAWS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了CC_INCREMENT_GL_DRAWS函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: b2Vec2

			void GLESDebugDraw::DrawCircle(const b2Vec2& center, float32 radius, const b2Color& color)			{				mShaderProgram->use();				mShaderProgram->setUniformsForBuiltins();				const float32 k_segments = 16.0f;				int vertexCount=16;				const float32 k_increment = 2.0f * b2_pi / k_segments;				float32 theta = 0.0f;				GLfloat*    glVertices = new GLfloat[vertexCount*2];				for (int i = 0; i < k_segments; ++i)				{					b2Vec2 v = center + radius * b2Vec2(cosf(theta), sinf(theta));					glVertices[i*2]=v.x * mRatio;					glVertices[i*2+1]=v.y * mRatio;					theta += k_increment;				}				mShaderProgram->setUniformLocationWith4f(mColorLocation, color.r, color.g, color.b, 1);				glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, glVertices);				glDrawArrays(GL_LINE_LOOP, 0, vertexCount);				CC_INCREMENT_GL_DRAWS(1);				CHECK_GL_ERROR_DEBUG();				delete[] glVertices;			}
开发者ID:DukeWong,项目名称:PokerMan,代码行数:30,


示例2: glVertexAttribPointer

			void GLESDebugDraw::DrawSolidPolygon(const b2Vec2* old_vertices, int vertexCount, const b2Color& color)			{				mShaderProgram->use();				mShaderProgram->setUniformsForBuiltins();				b2Vec2* vertices = new b2Vec2[vertexCount];				for( int i=0;i<vertexCount;i++) {					vertices[i] = old_vertices[i];					vertices[i] *= mRatio;				}				mShaderProgram->setUniformLocationWith4f(mColorLocation, color.r*0.5f, color.g*0.5f, color.b*0.5f, 0.5f);				glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, vertices);				glDrawArrays(GL_TRIANGLE_FAN, 0, vertexCount);				mShaderProgram->setUniformLocationWith4f(mColorLocation, color.r, color.g, color.b, 1);				glDrawArrays(GL_LINE_LOOP, 0, vertexCount);				CC_INCREMENT_GL_DRAWS(2);				CHECK_GL_ERROR_DEBUG();				delete[] vertices;			}
开发者ID:DukeWong,项目名称:PokerMan,代码行数:26,


示例3: ccGLEnableVertexAttribs

void CCGSpell::onDraw(const Mat4 &transform, uint32_t flags){	// 启用attributes变量输入,顶点坐标,纹理坐标,颜色	ccGLEnableVertexAttribs(kCCVertexAttribFlag_PosColorTex);	_pShaderProgram->use();	_pShaderProgram->setUniformsForBuiltins(transform);	// 绑定纹理到纹理槽0	ccGLBindTexture2D(_texture->getName());	long offset = (long)&_quad;	// vertex	int diff = offsetof(V3F_C4B_T2F, vertices);	glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, sizeof(V3F_C4B_T2F), (void*)(offset + diff));	// texCoods	diff = offsetof(V3F_C4B_T2F, texCoords);	glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, sizeof(V3F_C4B_T2F), (void*)(offset + diff));	// color	diff = offsetof(V3F_C4B_T2F, colors);	glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(V3F_C4B_T2F), (void*)(offset + diff));	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);	CC_INCREMENT_GL_DRAWS(1);}
开发者ID:gameboy12615,项目名称:CCGEditor,代码行数:27,


示例4: drawPoint

void drawPoint( const Point& point ){    lazy_init();    Vertex2F p;    p.x = point.x;    p.y = point.y;    GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION );    s_shader->use();    s_shader->setUniformsForBuiltins();    s_shader->setUniformLocationWith4fv(s_colorLocation, (GLfloat*) &s_color.r, 1);    s_shader->setUniformLocationWith1f(s_pointSizeLocation, s_pointSize);#ifdef EMSCRIPTEN    setGLBufferData(&p, 8);    glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, 0);#else    glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, &p);#endif // EMSCRIPTEN    glDrawArrays(GL_POINTS, 0, 1);    CC_INCREMENT_GL_DRAWS(1);}
开发者ID:Gamex,项目名称:GameX,代码行数:26,


示例5: CC_NODE_DRAW_SETUP

void CCLayerColor::draw(){    CC_NODE_DRAW_SETUP();    ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position | kCCVertexAttribFlag_Color );    //    // Attributes    //#ifdef EMSCRIPTEN    setGLBufferData(m_pSquareVertices, 4 * sizeof(ccVertex2F), 0);    glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, 0);    setGLBufferData(m_pSquareColors, 4 * sizeof(ccColor4F), 1);    glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_FLOAT, GL_FALSE, 0, 0);#else    glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, m_pSquareVertices);    glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_FLOAT, GL_FALSE, 0, m_pSquareColors);#endif // EMSCRIPTEN    ccGLBlendFunc( m_tBlendFunc.src, m_tBlendFunc.dst );    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);    CC_INCREMENT_GL_DRAWS(1);}
开发者ID:brooklynpacket,项目名称:cocos2d-x,代码行数:26,


示例6: ccDrawSolidPoly

void ccDrawSolidPoly( const CCPoint *poli, unsigned int numberOfPoints, ccColor4F color ){    lazy_init();    s_pShader->use();    s_pShader->setUniformsForBuiltins();    s_pShader->setUniformLocationWith4fv(s_nColorLocation, (GLfloat*) &color.r, 1);    ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position );    // XXX: Mac OpenGL error. arrays can't go out of scope before draw is executed    ccVertex2F* newPoli = new ccVertex2F[numberOfPoints];    // iPhone and 32-bit machines optimization    if( sizeof(CCPoint) == sizeof(ccVertex2F) )    {        glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, poli);    }    else    {        // Mac on 64-bit        for( unsigned int i=0; i<numberOfPoints; i++)        {            newPoli[i] = vertex2( poli[i].x, poli[i].y );        }        glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, newPoli);    }    glDrawArrays(GL_TRIANGLE_FAN, 0, (GLsizei) numberOfPoints);    CC_SAFE_DELETE_ARRAY(newPoli);    CC_INCREMENT_GL_DRAWS(1);}
开发者ID:Ratel13,项目名称:cocos2dx-swf,代码行数:33,


示例7: ccGLEnableVertexAttribs

void EXSunShineSprite::draw(){	ccGLEnableVertexAttribs(kCCVertexAttribFlag_PosColorTex);    m_sBlendFunc.src = GL_DST_COLOR;    m_sBlendFunc.dst = GL_ONE;	ccGLBlendFunc( m_sBlendFunc.src, m_sBlendFunc.dst );    	this->getShaderProgram()->use();	this->getShaderProgram()->setUniformsForBuiltins();    	ccGLBindTexture2D(  this->getTexture()->getName() );    #define kQuadSize sizeof(m_sQuad.bl)	long offset = (long)&m_sQuad;    	// vertex	int diff = offsetof( ccV3F_C4B_T2F, vertices);	glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, kQuadSize, (void*) (offset + diff));    	// texCoods	diff = offsetof( ccV3F_C4B_T2F, texCoords);	glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, kQuadSize, (void*)(offset + diff));    	// color	diff = offsetof( ccV3F_C4B_T2F, colors);	glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_UNSIGNED_BYTE, GL_TRUE, kQuadSize, (void*)(offset + diff));	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);	CC_INCREMENT_GL_DRAWS(1);}
开发者ID:grefZhou,项目名称:cocos2dx-extensions-master,代码行数:29,


示例8: ccDrawCubicBezier

void ccDrawCubicBezier(const CCPoint& origin, const CCPoint& control1, const CCPoint& control2, const CCPoint& destination, unsigned int segments){    lazy_init();    ccVertex2F* vertices = new ccVertex2F[segments + 1];    float t = 0;    for(unsigned int i = 0; i < segments; i++)    {        vertices[i].x = powf(1 - t, 3) * origin.x + 3.0f * powf(1 - t, 2) * t * control1.x + 3.0f * (1 - t) * t * t * control2.x + t * t * t * destination.x;        vertices[i].y = powf(1 - t, 3) * origin.y + 3.0f * powf(1 - t, 2) * t * control1.y + 3.0f * (1 - t) * t * t * control2.y + t * t * t * destination.y;        t += 1.0f / segments;    }    vertices[segments].x = destination.x;    vertices[segments].y = destination.y;    s_pShader->use();    s_pShader->setUniformsForBuiltins();    s_pShader->setUniformLocationWith4fv(s_nColorLocation, (GLfloat*) &s_tColor.r, 1);    ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position );    glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, vertices);    glDrawArrays(GL_LINE_STRIP, 0, (GLsizei) segments + 1);    CC_SAFE_DELETE_ARRAY(vertices);    CC_INCREMENT_GL_DRAWS(1);}
开发者ID:Ratel13,项目名称:cocos2dx-swf,代码行数:28,


示例9: ccGLEnableVertexAttribs

void RedSprite::draw(){    ccGLEnableVertexAttribs(kCCVertexAttribFlag_PosColorTex);    ccGLBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);    getShaderProgram()->use();    getShaderProgram()->setUniformsForBuiltins();    ccGLBindTexture2D(getTexture()->getName());    // attributes.#define kQuadSize sizeof(m_sQuad.bl)    long offset = (long)&m_sQuad;    //vertex    int diff = offsetof(ccV3F_C4B_T2F, vertices);    glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, kQuadSize, (void*) (offset + diff));    // texCoods.    diff = offsetof(ccV3F_C4B_T2F, texCoords);    glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, kQuadSize, (void*) (offset + diff));    // color    diff = offsetof(ccV3F_C4B_T2F, colors);    glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_UNSIGNED_BYTE, GL_TRUE, kQuadSize, (void*)(offset + diff));    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);    CC_INCREMENT_GL_DRAWS(1);}
开发者ID:elloop,项目名称:cocos2d-x-cpp-demos-2.x,代码行数:30,


示例10: drawQuadBezier

void drawQuadBezier(const Point& origin, const Point& control, const Point& destination, unsigned int segments){    lazy_init();    Vertex2F* vertices = new Vertex2F[segments + 1];    float t = 0.0f;    for(unsigned int i = 0; i < segments; i++)    {        vertices[i].x = powf(1 - t, 2) * origin.x + 2.0f * (1 - t) * t * control.x + t * t * destination.x;        vertices[i].y = powf(1 - t, 2) * origin.y + 2.0f * (1 - t) * t * control.y + t * t * destination.y;        t += 1.0f / segments;    }    vertices[segments].x = destination.x;    vertices[segments].y = destination.y;    s_shader->use();    s_shader->setUniformsForBuiltins();    s_shader->setUniformLocationWith4fv(s_colorLocation, (GLfloat*) &s_color.r, 1);    GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION );#ifdef EMSCRIPTEN    setGLBufferData(vertices, (segments + 1) * sizeof(Vertex2F));    glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, 0);#else    glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices);#endif // EMSCRIPTEN    glDrawArrays(GL_LINE_STRIP, 0, (GLsizei) segments + 1);    CC_SAFE_DELETE_ARRAY(vertices);    CC_INCREMENT_GL_DRAWS(1);}
开发者ID:Gamex,项目名称:GameX,代码行数:33,


示例11: atan2f

void FXLightning::render(){	float angle = atan2f(end.y - start.y , end.x - start.x);	float x = cosf(angle - M_PI/2.0) * width;	float y = sinf(angle - M_PI/2.0) * width;	float rx = cosf(angle - M_PI/2.0) * spread;	float ry = sinf(angle - M_PI/2.0) * spread;    static int counter = 0;		int n_samples = ccpDistance(start, end)/480 * K_NUMBER_OF_LIGHTNING_SAMPLES;	if (n_samples > K_NUMBER_OF_LIGHTNING_SAMPLES) {		n_samples = K_NUMBER_OF_LIGHTNING_SAMPLES;	}   	for (int i=0; i < n_samples; i+=2) {        CCPoint p = ccpLerp(start, end, i/(float)(n_samples-1));		float r = ((rand()%100) / 100.0 - 0.5) * 7;//        float r = 20* noise1(counter*speed);        float w = 0;        if (i < n_samples*0.5) {            w = i/(float)n_samples * 3;        }        else{            w = (n_samples-i-2)/(float)n_samples * 3;        }        w = clampf(w, 0, 1);        if (tapper == 0) {            vtx[ i+0 ].x = p.x + x + rx*r*w;            vtx[ i+0 ].y = p.y + y + ry*r*w;                        vtx[ i+1 ].x = p.x - x + rx*r*w;            vtx[ i+1 ].y = p.y - y + ry*r*w;        }        else{            vtx[ i+0 ].x = p.x + x*tapper*(1-i/(float)n_samples) + rx*r;            vtx[ i+0 ].y = p.y + y*tapper*(1-i/(float)n_samples) + ry*r;                        vtx[ i+1 ].x = p.x - x*tapper*(1-i/(float)n_samples) + rx*r;            vtx[ i+1 ].y = p.y - y*tapper*(1-i/(float)n_samples) + ry*r;        }        counter+=5;	}                pShaderProgram->use();    pShaderProgram->setUniformsForBuiltins();        ccGLBindTexture2D(texture->getName());        glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, vtx);    glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, 0, uvs);    glDrawArrays(GL_TRIANGLE_STRIP, 0,n_samples);        //DEBUG//    glDrawArrays(GL_LINE_STRIP, 0, n_samples);        CC_INCREMENT_GL_DRAWS(1);}
开发者ID:asd235614,项目名称:diamond,代码行数:59,


示例12: CC_PROFILER_START_CATEGORY

void HueSprite::draw(){    CC_PROFILER_START_CATEGORY(kCCProfilerCategorySprite, "CCSprite - draw");        	CCAssert(!m_pobBatchNode, "If CCSprite is being rendered by CCSpriteBatchNode, CCSprite#draw SHOULD NOT be called");        	//CC_NODE_DRAW_SETUP();	ccGLEnable( m_eGLServerState );        	ccGLBlendFunc( m_sBlendFunc.src, m_sBlendFunc.dst );        	m_shader->use();    m_shader->setUniformsForBuiltins();	if (m_pobTexture != NULL)	{		//ccGLBindTexture2D( m_texure1->getName());		glActiveTexture(GL_TEXTURE0);		glBindTexture(GL_TEXTURE_2D, m_pobTexture->getName());	}	else	{		ccGLBindTexture2D(0);	}	glUniformMatrix3fv(m_loc_hue, 1, GL_FALSE, (GLfloat*)&m_mat);	//	// Attributes	//	ccGLEnableVertexAttribs( kCCVertexAttribFlag_PosColorTex );        #define kQuadSize sizeof(m_sQuad.bl)	long offset = (long)&m_sQuad;        	// vertex	int diff = offsetof( ccV3F_C4B_T2F, vertices);	glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, kQuadSize, (void*) (offset + diff));        	// texCoods	diff = offsetof( ccV3F_C4B_T2F, texCoords);	glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, kQuadSize, (void*)(offset + diff));        	// color	diff = offsetof( ccV3F_C4B_T2F, colors);	glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_UNSIGNED_BYTE, GL_TRUE, kQuadSize, (void*)(offset + diff));                	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);        	CHECK_GL_ERROR_DEBUG();        	CC_INCREMENT_GL_DRAWS(1);        	CC_PROFILER_STOP_CATEGORY(kCCProfilerCategorySprite, "CCSprite - draw");}
开发者ID:AdamWu,项目名称:cocos2dx-extension,代码行数:59,


示例13: CCAssert

// overriding draw methodvoid CCParticleSystemQuad::draw(){        CCAssert(!m_pBatchNode,"draw should not be called when added to a particleBatchNode");    CC_NODE_DRAW_SETUP();    ccGLBindTexture2D( m_pTexture->getName() );    ccGLBlendFunc( m_tBlendFunc.src, m_tBlendFunc.dst );    CCAssert( m_uParticleIdx == m_uParticleCount, "Abnormal error in particle quad");#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();}
开发者ID:Atomz,项目名称:super-animation-samples,代码行数:59,


示例14: CCASSERT

// overriding draw methodvoid ParticleSystemQuad::draw(){        CCASSERT(!_batchNode,"draw should not be called when added to a particleBatchNode");    CC_NODE_DRAW_SETUP();    GL::bindTexture2D( _texture->getName() );    GL::blendFunc( _blendFunc.src, _blendFunc.dst );    CCASSERT( _particleIdx == _particleCount, "Abnormal error in particle quad");#if CC_TEXTURE_ATLAS_USE_VAO    //    // Using VBO and VAO    //    GL::bindVAO(_VAOname);#if CC_REBIND_INDICES_BUFFER    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _buffersVBO[1]);#endif    glDrawElements(GL_TRIANGLES, (GLsizei) _particleIdx*6, GL_UNSIGNED_SHORT, 0);#if CC_REBIND_INDICES_BUFFER    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);#endif#else    //    // Using VBO without VAO    //    #define kQuadSize sizeof(_quads[0].bl)    GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX );    glBindBuffer(GL_ARRAY_BUFFER, _buffersVBO[0]);    // vertices    glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, kQuadSize, (GLvoid*) offsetof( V3F_C4B_T2F, vertices));    // colors    glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, kQuadSize, (GLvoid*) offsetof( V3F_C4B_T2F, colors));    // tex coords    glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORDS, 2, GL_FLOAT, GL_FALSE, kQuadSize, (GLvoid*) offsetof( V3F_C4B_T2F, texCoords));        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _buffersVBO[1]);    glDrawElements(GL_TRIANGLES, (GLsizei) _particleIdx*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();}
开发者ID:ADoby,项目名称:Project_Space_Pirate,代码行数:57,


示例15: CC_NODE_DRAW_SETUP

void CCSprite3D::draw(){//    m_bDepthTestEnabled = 0 == glIsEnabled(GL_DEPTH_TEST) ? false : true;////    CCDirector::sharedDirector()->setDepthTest(true);//    CC_NODE_DRAW_SETUP();//    getShaderProgram()->use();//    getShaderProgram()->setUniformsForBuiltins();    CCPoint const & origin = ccp(0, 0);    CCPoint const & destination = ccp(100, 100);    ccVertex3F vertices[3] = {//        {origin.x, origin.y, 100},            {destination.x, origin.y, 200},            {destination.x, destination.y, 100},            {origin.x, destination.y, 200}    };    ccTex2F uv[3] = {//        {0.0f, 0.0f},            {1.0f, 0.0f},            {1.0f, 1.0f},            {0.0f, 1.0f}    };    ccColor4B colors[3] = {//        {255, 255, 255, 255},            {128, 128, 128, 128},            {128, 128, 128, 128},            {255, 255, 255, 255}    };    ccGLBindTexture2D(mCustSkin->getName());    ccGLEnableVertexAttribs( kCCVertexAttribFlag_PosColorTex );    glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, 0, vertices);    glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, 0, uv);    glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, colors);    glDrawArrays(GL_TRIANGLES, 0, 3);    CHECK_GL_ERROR_DEBUG();    CC_INCREMENT_GL_DRAWS(1);//    m_pModel->draw();//    static unsigned int uiStartFrame = 0, uiEndFrame = 182;//    static float fAnimSpeed = 16.5f;//   ((CCModelMd2*)m_pModel)->animate(fAnimSpeed, uiStartFrame, uiEndFrame, true);//   CCDirector::sharedDirector()->setDepthTest(m_bDepthTestEnabled);}
开发者ID:vedi,项目名称:cocos2d-x,代码行数:53,


示例16: memset

//-------------------------------------------------------------//- Render//- Renders a specific frame of the MD2 model//-------------------------------------------------------------void CCModelMd2::draw(unsigned int uiFrame){    float* m_pUV = new float[m_Head.numTriangles * 6];    memset(m_pUV, 0, m_Head.numTriangles * 6);    float* m_pVertices = new float[m_Head.numTriangles * 9];    memset(m_pVertices, 0, m_Head.numTriangles * 9);    int uvIdx = 0;    int vertexIdx = 0;    for (int i =0; i < m_Head.numTriangles; i++)    {        m_pVertices[vertexIdx++] = m_pFrames[uiFrame].verts[m_pTriangles[i].vertIndices[0]].x;        m_pVertices[vertexIdx++] = m_pFrames[uiFrame].verts[m_pTriangles[i].vertIndices[0]].y;        m_pVertices[vertexIdx++] = m_pFrames[uiFrame].verts[m_pTriangles[i].vertIndices[0]].z;        m_pVertices[vertexIdx++] = m_pFrames[uiFrame].verts[m_pTriangles[i].vertIndices[1]].x;        m_pVertices[vertexIdx++] = m_pFrames[uiFrame].verts[m_pTriangles[i].vertIndices[1]].y;        m_pVertices[vertexIdx++] = m_pFrames[uiFrame].verts[m_pTriangles[i].vertIndices[1]].z;        m_pVertices[vertexIdx++] = m_pFrames[uiFrame].verts[m_pTriangles[i].vertIndices[2]].x;        m_pVertices[vertexIdx++] = m_pFrames[uiFrame].verts[m_pTriangles[i].vertIndices[2]].y;        m_pVertices[vertexIdx++] = m_pFrames[uiFrame].verts[m_pTriangles[i].vertIndices[2]].z;        m_pUV[uvIdx++] = m_pTexCoords[m_pTriangles[i].texIndices[0]].s;        m_pUV[uvIdx++] = m_pTexCoords[m_pTriangles[i].texIndices[0]].t;        m_pUV[uvIdx++] = m_pTexCoords[m_pTriangles[i].texIndices[1]].s;        m_pUV[uvIdx++] = m_pTexCoords[m_pTriangles[i].texIndices[1]].t;        m_pUV[uvIdx++] = m_pTexCoords[m_pTriangles[i].texIndices[2]].s;        m_pUV[uvIdx++] = m_pTexCoords[m_pTriangles[i].texIndices[2]].t;    }    ccGLEnableVertexAttribs(kCCVertexAttribFlag_Position | kCCVertexAttribFlag_TexCoords);    if(!m_bIsCustomSkin) {		if (m_pSkins) {			ccGLBindTexture2D(m_pSkins[m_uiSkin].m_Image->getName());		}	} else {        ccGLBindTexture2D(m_pCustSkin->getName());	}    glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, 0, m_pVertices);    glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, 0, m_pUV);    glDrawArrays(GL_TRIANGLES, 0, m_Head.numTriangles * 3);    CC_INCREMENT_GL_DRAWS(1);    CHECK_GL_ERROR_DEBUG();    CC_SAFE_DELETE_ARRAY(m_pUV);    CC_SAFE_DELETE_ARRAY(m_pVertices);}
开发者ID:eagle-su,项目名称:GameEngine,代码行数:57,


示例17: getGLProgramState

void FilledPolygon::onDraw(const Mat4 &transform, uint32_t flags){    GL::bindTexture2D(_texture->getName());    GL::blendFunc(_blendFunc.src, _blendFunc.dst);        getGLProgramState()->apply(transform);        glDrawArrays(GL_TRIANGLES, 0, (GLsizei)_verticesCount);        CC_INCREMENT_GL_DRAWS(1);    CHECK_GL_ERROR_DEBUG();}
开发者ID:dmazzella,项目名称:cocos2d-x-PRKit,代码行数:12,


示例18: ccDrawPoly

void ccDrawPoly( const CCPoint *poli, unsigned int numberOfPoints, bool closePolygon ){    lazy_init();    s_pShader->use();    s_pShader->setUniformsForBuiltins();    s_pShader->setUniformLocationWith4fv(s_nColorLocation, (GLfloat*) &s_tColor.r, 1);    ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position );    glLineWidth(1);    // iPhone and 32-bit machines optimization    if( sizeof(CCPoint) == sizeof(ccVertex2F) )    {#ifdef EMSCRIPTEN        setGLBufferData((void*) poli, numberOfPoints * sizeof(CCPoint));        glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, 0);#else        glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, poli);#endif // EMSCRIPTEN        if( closePolygon )            glDrawArrays(GL_LINE_LOOP, 0, (GLsizei) numberOfPoints);        else            glDrawArrays(GL_LINE_STRIP, 0, (GLsizei) numberOfPoints);    }    else    {        // Mac on 64-bit        // XXX: Mac OpenGL error. arrays can't go out of scope before draw is executed        ccVertex2F* newPoli = new ccVertex2F[numberOfPoints];        for( unsigned int i=0; i<numberOfPoints;i++) {            newPoli[i].x = poli[i].x;            newPoli[i].y = poli[i].y;        }#ifdef EMSCRIPTEN        setGLBufferData(newPoli, numberOfPoints * sizeof(ccVertex2F));        glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, 0);#else        glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, newPoli);#endif // EMSCRIPTEN        if( closePolygon )            glDrawArrays(GL_LINE_LOOP, 0, (GLsizei) numberOfPoints);        else            glDrawArrays(GL_LINE_STRIP, 0, (GLsizei) numberOfPoints);        CC_SAFE_DELETE_ARRAY(newPoli);    }    CC_INCREMENT_GL_DRAWS(1);}
开发者ID:joyoyao,项目名称:AndroidVideo,代码行数:52,


示例19: CC_PROFILER_START_CATEGORY

/** * 绘制 */void MapCoordLine::draw(void){	CC_PROFILER_START_CATEGORY(kCCProfilerCategorySprite, "CCSprite - draw");	CCAssert(!m_pobBatchNode, "If CCSprite is being rendered by CCSpriteBatchNode, CCSprite#draw SHOULD NOT be called");	CC_NODE_DRAW_SETUP();	ccGLBlendFunc( m_sBlendFunc.src, m_sBlendFunc.dst );	if (m_pobTexture != NULL)	{		ccGLBindTexture2D( m_pobTexture->getName() );	}	else	{		ccGLBindTexture2D(0);	}	//	// Attributes	//	ccGLEnableVertexAttribs( kCCVertexAttribFlag_PosColorTex );	#define kQuadSize sizeof(m_sQuad.bl)	if (points.size())	{		long offset = (long)&points[0];		// vertex		int diff = offsetof( ccV3F_C4B_T2F, vertices);		glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, kQuadSize, (void*) (offset + diff));		// texCoods		diff = offsetof( ccV3F_C4B_T2F, texCoords);		glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, kQuadSize, (void*)(offset + diff));		// color		diff = offsetof( ccV3F_C4B_T2F, colors);		glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_UNSIGNED_BYTE, GL_TRUE, kQuadSize, (void*)(offset + diff));		glDrawArrays(GL_LINES, 0, points.size());	}	CHECK_GL_ERROR_DEBUG();	CC_INCREMENT_GL_DRAWS(1);	CC_PROFILER_STOP_CATEGORY(kCCProfilerCategorySprite, "CCSprite - draw");}
开发者ID:coderHsc,项目名称:sygame,代码行数:54,


示例20: ccDrawCardinalSpline

void ccDrawCardinalSpline( CCPointArray *config, float tension,  unsigned int segments ){    lazy_init();    ccVertex2F* vertices = new ccVertex2F[segments + 1];    unsigned int p;    float lt;    float deltaT = 1.0f / config->count();    for( unsigned int i=0; i < segments+1;i++) {        float dt = (float)i / segments;        // border        if( dt == 1 ) {            p = config->count() - 1;            lt = 1;        } else {            p = dt / deltaT;            lt = (dt - deltaT * (float)p) / deltaT;        }        // Interpolate        CCPoint pp0 = config->get(p-1);        CCPoint pp1 = config->get(p+0);        CCPoint pp2 = config->get(p+1);        CCPoint pp3 = config->get(p+2);        CCPoint newPos = ccCardinalSplineAt( pp0, pp1, pp2, pp3, tension, lt);        vertices[i].x = newPos.x;        vertices[i].y = newPos.y;    }    s_pShader->use();    s_pShader->setUniformsForBuiltins();    s_pShader->setUniformLocationWith4fv(s_nColorLocation, (GLfloat*)&s_tColor.r, 1);    ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position );#ifdef EMSCRIPTEN    setGLBufferData(vertices, (segments + 1) * sizeof(ccVertex2F));    glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, 0);#else    glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, vertices);#endif // EMSCRIPTEN    glDrawArrays(GL_LINE_STRIP, 0, (GLsizei) segments + 1);    CC_SAFE_DELETE_ARRAY(vertices);    CC_INCREMENT_GL_DRAWS(1);}
开发者ID:1085075003,项目名称:quick-cocos2d-x,代码行数:51,


示例21: ccDrawLines

void ccDrawLines(ccVertex2F* vertices,int size){    lazy_init();    s_pShader->use();    s_pShader->setUniformsForBuiltins();    s_pShader->setUniformLocationWith4fv(s_nColorLocation, (GLfloat*) &s_tColor.r, 1);    ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position );    glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, vertices);    glDrawArrays(GL_LINE_STRIP, 0, size);    CC_INCREMENT_GL_DRAWS(1);}
开发者ID:Ratel13,项目名称:cocos2dx-swf,代码行数:16,


示例22: glVertices

void GHDebugDrawLayer::DrawSolidCircleWithCenter(const b2Vec2& center,                                                 float32 radius,                                                 const b2Vec2& axis,                                                 const b2Color& color,                                                 CCGLProgram* mShaderProgram,                                                 GLint mColorLocation,                                                 float mRatio){    mShaderProgram->use();    mShaderProgram->setUniformsForBuiltins();    	const float32 k_segments = 16.0f;	int vertexCount=16;	const float32 k_increment = 2.0f * b2_pi / k_segments;	float32 theta = 0.0f;    	std::vector<GLfloat> glVertices(vertexCount*2);	for (int32 i = 0; i < k_segments; ++i)	{		b2Vec2 v = center + radius * b2Vec2(cosf(theta), sinf(theta));		glVertices[i*2]=v.x * mRatio;		glVertices[i*2+1]=v.y * mRatio;		theta += k_increment;	}        mShaderProgram->setUniformLocationWith4f(mColorLocation, color.r*0.5f, color.g*0.5f, color.b*0.5f, 0.5f);    glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, &glVertices[0]);	glDrawArrays(GL_TRIANGLE_FAN, 0, vertexCount);        mShaderProgram->setUniformLocationWith4f(mColorLocation, color.r, color.g, color.b, 1);    	glDrawArrays(GL_LINE_LOOP, 0, vertexCount);    	// Draw the axis line        GHDebugDrawLayer::DrawSegmentWithPoint1(center,                                            center+radius*axis,                                            color,                                            mShaderProgram,                                            mColorLocation,                                            mRatio);        	CC_INCREMENT_GL_DRAWS(2);    	CHECK_GL_ERROR_DEBUG();}
开发者ID:vladubogdan,项目名称:GameDevHelperAPI-Cocos2d-X,代码行数:47,


示例23: ccDrawPoints

void ccDrawPoints( const CCPoint *points, unsigned int numberOfPoints ){    lazy_init();    ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position );    s_pShader->use();    s_pShader->setUniformsForBuiltins();    s_pShader->setUniformLocationWith4fv(s_nColorLocation, (GLfloat*) &s_tColor.r, 1);    s_pShader->setUniformLocationWith1f(s_nPointSizeLocation, s_fPointSize);    // XXX: Mac OpenGL error. arrays can't go out of scope before draw is executed    ccVertex2F* newPoints = new ccVertex2F[numberOfPoints];    // iPhone and 32-bit machines optimization    if( sizeof(CCPoint) == sizeof(ccVertex2F) )    {#ifdef EMSCRIPTEN        setGLBufferData((void*) points, numberOfPoints * sizeof(CCPoint));        glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, 0);#else        glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, points);#endif // EMSCRIPTEN    }    else    {        // Mac on 64-bit        for( unsigned int i=0; i<numberOfPoints;i++) {            newPoints[i].x = points[i].x;            newPoints[i].y = points[i].y;        }#ifdef EMSCRIPTEN        // Suspect Emscripten won't be emitting 64-bit code for a while yet,        // but want to make sure this continues to work even if they do.        setGLBufferData(newPoints, numberOfPoints * sizeof(ccVertex2F));        glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, 0);#else        glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, newPoints);#endif // EMSCRIPTEN    }    glDrawArrays(GL_POINTS, 0, (GLsizei) numberOfPoints);    CC_SAFE_DELETE_ARRAY(newPoints);    CC_INCREMENT_GL_DRAWS(1);}
开发者ID:1085075003,项目名称:quick-cocos2d-x,代码行数:46,


示例24: drawCircle

void drawCircle( const Point& center, float width, float height, float angle, unsigned int segments, bool drawLineToCenter, float scaleX, float scaleY){	lazy_init();	width *= 0.5f;	height *= 0.5f;	int additionalSegment = 1;	if (drawLineToCenter)		additionalSegment++;	const float coef = 2.0f * (float)M_PI/segments;	GLfloat *vertices = (GLfloat*)calloc( sizeof(GLfloat)*2*(segments+2), 1);	if( ! vertices )		return;	for(unsigned int i = 0;i <= segments; i++) {		float rads = i*coef;		GLfloat j = width * cosf(rads + angle) * scaleX + center.x;		GLfloat k = height * sinf(rads + angle) * scaleY + center.y;		vertices[i*2] = j;		vertices[i*2+1] = k;	}	vertices[(segments+1)*2] = center.x;	vertices[(segments+1)*2+1] = center.y;	s_shader->use();	s_shader->setUniformsForBuiltins();	s_shader->setUniformLocationWith4fv(s_colorLocation, (GLfloat*) &s_color.r, 1);	GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION );#ifdef EMSCRIPTEN	setGLBufferData(vertices, sizeof(GLfloat)*2*(segments+2));	glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, 0);#else	glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices);#endif // EMSCRIPTEN	glDrawArrays(GL_LINE_STRIP, 0, (GLsizei) segments+additionalSegment);	::free( vertices );	CC_INCREMENT_GL_DRAWS(1);}
开发者ID:chling,项目名称:artemis,代码行数:46,


示例25: CC_PROFILER_START_CATEGORY

void ShaderSprite::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags){    CC_PROFILER_START_CATEGORY(kCCProfilerCategorySprite, "CCSprite - draw");    // CCAssert(, "If CCSprite is being rendered by CCSpriteBatchNode, CCSprite#draw SHOULD NOT be called");    CC_NODE_DRAW_SETUP();    //    // 启用attributes变量输入,顶点坐标,纹理坐标,颜色    //    ccGLEnableVertexAttribs( kCCVertexAttribFlag_PosColorTex );    ccGLBlendFunc(this->getBlendFunc().src, this->getBlendFunc().dst);    this->getShaderProgram()->use();    this->getShaderProgram()->setUniformsForBuiltins();    // 绑定纹理到纹理槽0    ccGLBindTexture2D(this->getTexture()->getName());#define kQuadSize sizeof(this->_quad.bl)    long offset = (long)&this->_quad;    // vertex    int diff = offsetof( ccV3F_C4B_T2F, vertices);    glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, kQuadSize, (void*) (offset + diff));    // texCoods    diff = offsetof( ccV3F_C4B_T2F, texCoords);    glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, kQuadSize, (void*)(offset + diff));    // color    diff = offsetof( ccV3F_C4B_T2F, colors);    glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_UNSIGNED_BYTE, GL_TRUE, kQuadSize, (void*)(offset + diff));    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);    CHECK_GL_ERROR_DEBUG();    CC_INCREMENT_GL_DRAWS(1);    CC_PROFILER_STOP_CATEGORY(kCCProfilerCategorySprite, "CCSprite - draw");}
开发者ID:xubingyue,项目名称:libxstudio365,代码行数:45,


示例26: CC_NODE_DRAW_SETUP

void CCLayerColor::draw(){    CC_NODE_DRAW_SETUP();    ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position | kCCVertexAttribFlag_Color );    //    // Attributes    //    glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, m_pSquareVertices);    glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_FLOAT, GL_FALSE, 0, m_pSquareColors);    ccGLBlendFunc( m_tBlendFunc.src, m_tBlendFunc.dst );    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);    CC_INCREMENT_GL_DRAWS(1);}
开发者ID:niuzb,项目名称:hellopetclient,代码行数:18,


示例27: ccDrawLine

void ccDrawLine( const CCPoint& origin, const CCPoint& destination ){    lazy_init();    ccVertex2F vertices[2] = {        {origin.x, origin.y},        {destination.x, destination.y}    };    s_pShader->use();    s_pShader->setUniformsForBuiltins();    s_pShader->setUniformLocationWith4fv(s_nColorLocation, (GLfloat*) &s_tColor.r, 1);    ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position );    glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, vertices);    glDrawArrays(GL_LINES, 0, 2);    CC_INCREMENT_GL_DRAWS(1);}
开发者ID:Ratel13,项目名称:cocos2dx-swf,代码行数:19,


示例28: ccDrawCircle

void ccDrawCircle(const CCPoint& center, float radius, float angle, unsigned int segments, bool drawLineToCenter, float scaleX, float scaleY, bool fill){    lazy_init();    int additionalSegment = 1;    if (drawLineToCenter)        additionalSegment++;    const float coef = 2.0f * (float)M_PI/segments;    GLfloat *vertices = (GLfloat*)calloc( sizeof(GLfloat)*2*(segments+2), 1);    if( ! vertices )        return;    for(unsigned int i = 0;i <= segments; i++) {        float rads = i*coef;        GLfloat j = radius * cosf(rads + angle) * scaleX + center.x;        GLfloat k = radius * sinf(rads + angle) * scaleY + center.y;        vertices[i*2] = j;        vertices[i*2+1] = k;    }    vertices[(segments+1)*2] = center.x;    vertices[(segments+1)*2+1] = center.y;    s_pShader->use();    s_pShader->setUniformsForBuiltins();    s_pShader->setUniformLocationWith4fv(s_nColorLocation, (GLfloat*) &s_tColor.r, 1);    ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position );#ifdef EMSCRIPTEN    setGLBufferData(vertices, sizeof(GLfloat)*2*(segments+2));    glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, 0);#else    glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, vertices);#endif // EMSCRIPTEN	glDrawArrays(fill ? GL_TRIANGLE_FAN : GL_LINE_STRIP, 0, (GLsizei)segments + additionalSegment);    free( vertices );    CC_INCREMENT_GL_DRAWS(1);}
开发者ID:1085075003,项目名称:quick-cocos2d-x,代码行数:43,


示例29: ccDrawColor4B

void CPrimitiveScene::draw(){        CCCamera* pCamera = CCDirector::sharedDirector()->getRunningScene()->getCamera();    pCamera->setEyeXYZ(0,0,10);    pCamera->setCenterXYZ(-50.0f, -50.0f, 0);    // open yellow poly    ccDrawColor4B(255, 255, 0, 255);    glLineWidth(10);    ccVertex3F vertices[] = { vertex3(0,0,0), vertex3(50,50,0), vertex3(100,50,0), vertex3(100,100,0), vertex3(50,100,0.1) };            s_pShader->use();    s_pShader->setUniformForModelViewProjectionMatrix();    s_pShader->setUniformLocationWith4fv(s_nColorLocation, (GLfloat*) &s_tColor.r, 1);    ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position );    int numberOfPoints = 5;    // XXX: Mac OpenGL error. arrays can't go out of scope before draw is executed    ccVertex3F* newPoli = new ccVertex3F[numberOfPoints];    // iPhone and 32-bit machines optimization    if( sizeof(CCPoint) == sizeof(ccVertex3F) )    {        glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, 0, vertices);    }    else    {        // Mac on 64-bit        for( unsigned int i=0; i<numberOfPoints;i++)        {            newPoli[i] = vertex3( vertices[i].x, vertices[i].y, vertices[i].z );        }        glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, 0, newPoli);    }        glDrawArrays(GL_TRIANGLE_FAN, 0, (GLsizei) numberOfPoints);    CC_SAFE_DELETE_ARRAY(newPoli);    CC_INCREMENT_GL_DRAWS(1);}
开发者ID:valkidy,项目名称:homedefence,代码行数:43,


示例30: drawSolidPoly

void drawSolidPoly( const Point *poli, unsigned int numberOfPoints, Color4F color ){    lazy_init();    s_shader->use();    s_shader->setUniformsForBuiltins();    s_shader->setUniformLocationWith4fv(s_colorLocation, (GLfloat*) &color.r, 1);    GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION );    // XXX: Mac OpenGL error. arrays can't go out of scope before draw is executed    Vertex2F* newPoli = new Vertex2F[numberOfPoints];    // iPhone and 32-bit machines optimization    if( sizeof(Point) == sizeof(Vertex2F) )    {#ifdef EMSCRIPTEN        setGLBufferData((void*) poli, numberOfPoints * sizeof(Point));        glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, 0);#else        glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, poli);#endif // EMSCRIPTEN    }    else    {        // Mac on 64-bit        for( unsigned int i=0; i<numberOfPoints;i++)        {            newPoli[i] = Vertex2F( poli[i].x, poli[i].y );        }#ifdef EMSCRIPTEN        setGLBufferData(newPoli, numberOfPoints * sizeof(Vertex2F));        glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, 0);#else        glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, newPoli);#endif // EMSCRIPTEN    }        glDrawArrays(GL_TRIANGLE_FAN, 0, (GLsizei) numberOfPoints);    CC_SAFE_DELETE_ARRAY(newPoli);    CC_INCREMENT_GL_DRAWS(1);}
开发者ID:Gamex,项目名称:GameX,代码行数:43,



注:本文中的CC_INCREMENT_GL_DRAWS函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ CC_NODE_DRAW_SETUP函数代码示例
C++ CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。