本文整理汇总了C++中GLTexture::Bind方法的典型用法代码示例。如果您正苦于以下问题:C++ GLTexture::Bind方法的具体用法?C++ GLTexture::Bind怎么用?C++ GLTexture::Bind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLTexture
的用法示例。
在下文中一共展示了GLTexture::Bind方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scope
void
Canvas::DrawTransparentText(int x, int y, 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;
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);
}
示例2: 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);
}
}
示例3: SetTexture
void GLSLProgram::SetTexture(const string& name,
const GLTexture& pTexture) {
if (m_mBindings.find(name) == m_mBindings.end ()) {
// find a free texture unit
int iUnusedTexUnit = 0;
for (texMap::iterator i = m_mBindings.begin();i != m_mBindings.end();++i){
if (i->second <= iUnusedTexUnit)
iUnusedTexUnit = i->second+1;
}
ConnectTextureID(name, iUnusedTexUnit);
pTexture.Bind(iUnusedTexUnit);
} else {
pTexture.Bind(m_mBindings[name]);
}
}
示例4: assert
void
Canvas::CopyToTexture(GLTexture &texture, PixelRect src_rc) const
{
#ifdef HAVE_GLES
assert(offset == OpenGL::translate);
#endif
texture.Bind();
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0,
OpenGL::translate.x + src_rc.left,
OpenGL::viewport_size.y - OpenGL::translate.y - src_rc.bottom,
src_rc.right - src_rc.left,
src_rc.bottom - src_rc.top);
}
示例5: assert
void
Canvas::CopyToTexture(GLTexture &texture, PixelRect src_rc) const
{
#ifdef HAVE_GLES
assert(x_offset == OpenGL::translate_x);
assert(y_offset == OpenGL::translate_y);
#endif
texture.Bind();
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0,
OpenGL::translate_x + src_rc.left,
OpenGL::screen_height - OpenGL::translate_y - src_rc.bottom,
src_rc.right - src_rc.left,
src_rc.bottom - src_rc.top);
}