当前位置: 首页>>代码示例>>C++>>正文


C++ CCGLProgram::setUniformsForBuiltins方法代码示例

本文整理汇总了C++中CCGLProgram::setUniformsForBuiltins方法的典型用法代码示例。如果您正苦于以下问题:C++ CCGLProgram::setUniformsForBuiltins方法的具体用法?C++ CCGLProgram::setUniformsForBuiltins怎么用?C++ CCGLProgram::setUniformsForBuiltins使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCGLProgram的用法示例。


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

示例1:

static int tolua_CCGLProgram_CCGLProgram_setUniformsForBuiltins00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"CCGLProgram",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  CCGLProgram* self = (CCGLProgram*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'setUniformsForBuiltins'", NULL);
#endif
  {
   self->setUniformsForBuiltins();
  }
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'setUniformsForBuiltins'.",&tolua_err);
 return 0;
#endif
}
开发者ID:imuzi,项目名称:MyApp,代码行数:27,代码来源:tolua_CCGLProgram.cpp

示例2: draw

void XSpriteBatchNode::draw()
{
	XFUNC_START();
	CC_PROFILER_START("XSpriteBatchNode - draw");

	if (m_pobTextureAtlas->getTotalQuads() == 0)
	{
		return;
	}
	do 
	{
		ccGLEnable(m_eGLServerState);
		if (m_pShaderKTX)
		{
			CCGLProgram* pProg = m_pShaderKTX->GetProgram();
			if (pProg)
			{
				pProg->use();
				pProg->setUniformsForBuiltins();
			}
		}
		else
		{
			if (getShaderProgram())
			{
				getShaderProgram()->use();
				getShaderProgram()->setUniformsForBuiltins();
			}			
		}
		if(m_pShaderOnce)
		{
			m_pShaderOnce->use();
			m_pShaderOnce->setUniformsForBuiltins();
			if(m_pShaderOnce->m_pShader)
				m_pShaderOnce->m_pShader->RunBeforeDraw();
			m_pShaderOnce = NULL;
		}
		//else if(m_pobTextureAtlas->getTexture())
		//{
		//	static XShaderBloom stShaderBloom;
		//	stShaderBloom.UseShader();
		//	stShaderBloom.SetTexSize(SCRPIX_W, SCRPIX_H);
		//}
	} while (0);
	arrayMakeObjectsPerformSelector(m_pChildren, updateTransform, CCSprite*);
	ccGLBlendFunc(m_blendFunc.src, m_blendFunc.dst);
	if (m_pTexKtxAlpha)
	{
		ccGLBindTexture2DN(1, m_pTexKtxAlpha->getName());
		if (m_pShaderKTX)
		{
			m_pShaderKTX->RunBeforeDraw();
		}	
	}
	m_pobTextureAtlas->drawQuads();
	CC_PROFILER_STOP("XSpriteBatchNode - draw");
	
	XFUNC_END();
}
开发者ID:SLS-ACT,项目名称:TeamTest,代码行数:59,代码来源:XSpriteBatchNode.cpp

示例3: sizeof

	void Cocos2dRenderManager::doRender(IVertexBuffer* _buffer, ITexture* _texture, size_t _count)
	{
		Cocos2dVertexBuffer* buffer = static_cast<Cocos2dVertexBuffer*>(_buffer);
		unsigned int buffer_id = buffer->getBufferID();

		unsigned int texture_id = 0;
		Cocos2dTexture* texture = static_cast<Cocos2dTexture*>(_texture);
		texture_id = texture->getGLTexture();

		//MYGUI_PLATFORM_ASSERT(buffer_id, "Texture is not created");
		//MYGUI_PLATFORM_ASSERT(texture_id, "Texture is not created");
		if (!buffer_id) return;
		if (!texture_id) return;

		ccGLEnable(m_eGLServerState);

		CCGLProgram* shaderProgram = NULL;
		cocos2d::ccBlendFunc blendFunc;

		shaderProgram = CCShaderCache::sharedShaderCache()->programForKey(kCCShader_PositionTextureColor_MyGUI);
		// 对于
		if (texture->getCocos2dTexture()->hasPremultipliedAlpha())
		{
			blendFunc.src = CC_BLEND_SRC;
			blendFunc.dst = CC_BLEND_DST;
		}
		else
		{
			blendFunc.src = GL_SRC_ALPHA;
			blendFunc.dst = GL_ONE_MINUS_SRC_ALPHA;
		}

		shaderProgram->use();
		shaderProgram->setUniformsForBuiltins();
		ccGLBlendFunc(blendFunc.src, blendFunc.dst);

		ccGLEnableVertexAttribs( kCCVertexAttribFlag_PosColorTex );

		ccGLBindTexture2D(texture_id);
		glBindBuffer(GL_ARRAY_BUFFER, buffer_id);

		glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, x));
		glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Vertex), (void*)offsetof(Vertex, colour));
		glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, u));

		glDrawArrays(GL_TRIANGLES, 0, _count);

		vbo_count++;
		vertex_count += _count;

		glBindBuffer(GL_ARRAY_BUFFER, 0);
	}
开发者ID:dayongxie,项目名称:MyGUI,代码行数:52,代码来源:MyGUI_Cocos2dRenderManager.cpp


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