本文整理汇总了C++中Texture::Bufferize方法的典型用法代码示例。如果您正苦于以下问题:C++ Texture::Bufferize方法的具体用法?C++ Texture::Bufferize怎么用?C++ Texture::Bufferize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Texture
的用法示例。
在下文中一共展示了Texture::Bufferize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Process
void GMBufferTexture::Process()
{
Texture * texturePtr;
if (textureID != -1)
texturePtr = TexMan.GetTextureByID(textureID);
else
texturePtr = t;
if (texturePtr == NULL){
std::cout<<"Null-Texture was queued to buffering!";
return;
}
if (texturePtr->glid != -1 && !texturePtr->dynamic){
std::cout<<"\nTexture "<<texturePtr->name<<" is already buffered (has glid)!";
return;
}
texturePtr->Bufferize();
return;
}
示例2: RenderSelection
/// Render the character as selected.
void TextFont::RenderSelection(uchar c)
{
/// No good solution for this... yet.
if (shaderBased)
{
return;
}
// Stop the quads.
glEnd();
CheckGLError("TextFont::RenderSelection 1");
// Switch to additive rendering
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
CheckGLError("TextFont::RenderSelection 1.5");
int characterX = c % 16;
int characterY = c / 16;
/// Texture co-ordinates.
float & xStart = pivotPoint[0];
float & yStart = pivotPoint[1];
// Bind the texture to use. Preferably a gray sort.
Texture * tex = TexMan.GetTextureByHex32(0xFFFFFF22);
if (tex->glid == -1)
tex->Bufferize();
glBindTexture(GL_TEXTURE_2D, tex->glid);
CheckGLError("TextFont::RenderSelection 2");
float width = this->charWidth[c];
float halfWidth = width * 0.5f;
// Render the quad!
glBegin(GL_QUADS);
float x1 = halfWidth * -halfScale[0] + xStart - padding[0] * 0.5f,
x2 = halfWidth * halfScale[0] + xStart + padding[0] * 0.5f;
// And actual rendering.
glTexCoord2f(0, 1);
glVertex3f(x2, -halfScale[1] + yStart, 0);
glTexCoord2f(1, 1);
glVertex3f(x1, -halfScale[1] + yStart, 0);
glTexCoord2f(1, 0);
glVertex3f(x1, halfScale[1] + yStart, 0);
glTexCoord2f(0, 0);
glVertex3f(x2, halfScale[1] + yStart, 0);
glEnd();
CheckGLError("TextFont::RenderSelection 3");
// Re-bind old texture.
glBindTexture(GL_TEXTURE_2D, this->texture->glid);
// Reset blend-mode.
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
CheckGLError("TextFont::RenderSelection 4");
// Begin quads again.
glBegin(GL_QUADS);
}