本文整理汇总了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;
}
示例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);
}
示例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);
}