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


C++ OpenGLTexture::getTextureID方法代码示例

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


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

示例1: setTexture

void OpenGLRenderer::setTexture(Texture *texture) {

	if(texture == NULL) {
		glActiveTexture(GL_TEXTURE0);		
		glDisable(GL_TEXTURE_2D);
		return;
	}
	
    glActiveTexture(GL_TEXTURE0);
    glEnable (GL_TEXTURE_2D);
            
    if(currentTexture != texture) {			
        OpenGLTexture *glTexture = (OpenGLTexture*)texture;
        glBindTexture (GL_TEXTURE_2D, glTexture->getTextureID());
    }
	
	currentTexture = texture;
}
开发者ID:HeadClot,项目名称:Polycode,代码行数:18,代码来源:PolyGLRenderer.cpp

示例2: doRender

	void OpenGLRenderManager::doRender(IVertexBuffer* _buffer, ITexture* _texture, size_t _count)
	{
		OpenGLVertexBuffer* buffer = static_cast<OpenGLVertexBuffer*>(_buffer);
		unsigned int buffer_id = buffer->getBufferID();
		MYGUI_PLATFORM_ASSERT(buffer_id, "Vertex buffer is not created");

		unsigned int texture_id = 0;
		if (_texture)
		{
			OpenGLTexture* texture = static_cast<OpenGLTexture*>(_texture);
			texture_id = texture->getTextureID();
			//MYGUI_PLATFORM_ASSERT(texture_id, "Texture is not created");
		}

		glBindTexture(GL_TEXTURE_2D, texture_id);

		glBindBuffer(GL_ARRAY_BUFFER, buffer_id);

		// enable vertex arrays
		glEnableClientState(GL_VERTEX_ARRAY);
		glEnableClientState(GL_COLOR_ARRAY);
		glEnableClientState(GL_TEXTURE_COORD_ARRAY);

		// before draw, specify vertex and index arrays with their offsets
		size_t offset = 0;
		glVertexPointer(3, GL_FLOAT, sizeof(Vertex), (void*)offset);
		offset += (sizeof(float) * 3);
		glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(Vertex), (void*)offset);
		offset += (4);
		glTexCoordPointer(2, GL_FLOAT, sizeof(Vertex), (void*)offset);

		glDrawArrays(GL_TRIANGLES, 0, _count);

		glDisableClientState(GL_TEXTURE_COORD_ARRAY);
		glDisableClientState(GL_COLOR_ARRAY);
		glDisableClientState(GL_VERTEX_ARRAY);

		glBindBuffer(GL_ARRAY_BUFFER, 0);
		glBindTexture(GL_TEXTURE_2D, 0);
	}
开发者ID:IsemanTech,项目名称:mygui,代码行数:40,代码来源:MyGUI_OpenGLRenderManager.cpp

示例3: renderToTexture

void OpenGLRenderer::renderToTexture(Texture *targetTexture) {
	OpenGLTexture *glTexture = (OpenGLTexture*)targetTexture;
	glBindTexture (GL_TEXTURE_2D, glTexture->getTextureID());
	glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, targetTexture->getWidth(), targetTexture->getHeight(), 0);	

}
开发者ID:aaajiao,项目名称:Polycode,代码行数:6,代码来源:PolyGLRenderer.cpp


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