本文整理汇总了C++中GLTexture::Draw方法的典型用法代码示例。如果您正苦于以下问题:C++ GLTexture::Draw方法的具体用法?C++ GLTexture::Draw怎么用?C++ GLTexture::Draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLTexture
的用法示例。
在下文中一共展示了GLTexture::Draw方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scope
void
Canvas::text_transparent(PixelScalar x, PixelScalar y, const TCHAR *text)
{
assert(text != NULL);
assert(ValidateUTF8(text));
#ifdef HAVE_GLES
assert(x_offset == OpenGL::translate_x);
assert(y_offset == OpenGL::translate_y);
#endif
if (font == NULL)
return;
GLTexture *texture = TextCache::Get(font, text);
if (texture == NULL)
return;
GLEnable scope(GL_TEXTURE_2D);
texture->Bind();
GLLogicOp logic_op(GL_AND_INVERTED);
/* cut out the shape in black */
OpenGL::glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
texture->Draw(x, y);
if (text_color != COLOR_BLACK) {
/* draw the text color on top */
OpenGL::glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
logic_op.set(GL_OR);
text_color.Set();
texture->Draw(x, y);
}
}
示例2: scope
void
Canvas::DrawClippedText(int x, int y,
unsigned width, unsigned height,
const TCHAR *text)
{
assert(text != nullptr);
assert(ValidateUTF8(text));
#ifdef HAVE_GLES
assert(offset == OpenGL::translate);
#endif
if (font == nullptr)
return;
GLTexture *texture = TextCache::Get(*font, text);
if (texture == nullptr)
return;
if (texture->GetHeight() < height)
height = texture->GetHeight();
if (texture->GetWidth() < width)
width = texture->GetWidth();
PrepareColoredAlphaTexture(text_color);
#ifndef USE_GLSL
GLEnable scope(GL_TEXTURE_2D);
#endif
const GLBlend blend(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
texture->Bind();
texture->Draw(x, y, width, height, 0, 0, width, height);
}
示例3: assert
void
Canvas::Stretch(int dest_x, int dest_y,
unsigned dest_width, unsigned dest_height,
const GLTexture &texture,
int src_x, int src_y,
unsigned src_width, unsigned src_height)
{
#ifdef HAVE_GLES
assert(offset == OpenGL::translate);
#endif
texture.Draw(dest_x, dest_y, dest_width, dest_height,
src_x, src_y, src_width, src_height);
}
示例4: assert
void
Canvas::Stretch(PixelScalar dest_x, PixelScalar dest_y,
UPixelScalar dest_width, UPixelScalar dest_height,
const GLTexture &texture,
PixelScalar src_x, PixelScalar src_y,
UPixelScalar src_width, UPixelScalar src_height)
{
#ifdef HAVE_GLES
assert(x_offset == OpenGL::translate_x);
assert(y_offset == OpenGL::translate_y);
#endif
texture.Draw(dest_x, dest_y, dest_width, dest_height,
src_x, src_y, src_width, src_height);
}