本文整理汇总了C++中TexturePtr::getHandle方法的典型用法代码示例。如果您正苦于以下问题:C++ TexturePtr::getHandle方法的具体用法?C++ TexturePtr::getHandle怎么用?C++ TexturePtr::getHandle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TexturePtr
的用法示例。
在下文中一共展示了TexturePtr::getHandle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bindTexture
void bindTexture(size_t unit, const TexturePtr& texture) {
if (unit > 0) {
// Only call this function if we know multitexturing is
// supported.
glActiveTextureARB(GL_TEXTURE0_ARB + unit);
}
if (texture) {
/// @todo With shaders, you don't need to glEnable the texture.
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture->getHandle());
} else {
glDisable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, 0);
}
if (unit > 0) {
glActiveTextureARB(GL_TEXTURE0_ARB);
}
}
示例2:
void kore::
TexturesComponent::addTexture(TexturePtr tex,
const bool useMipMaps /*=true*/,
const TextureSampler* sampler /*= NULL*/ ) {
if (std::find(_vTextures.begin(),
_vTextures.end(), tex) != _vTextures.end()) {
return;
}
STextureInfo* texInfo = new STextureInfo;
texInfo->texLocation = tex->getHandle();
texInfo->texTarget = tex->getProperties().targetType;
_vTextureInfos.push_back(texInfo);
ShaderData shaderdata;
shaderdata.type = GL_TEXTURE;
shaderdata.name = tex->getName();
shaderdata.data = texInfo;
shaderdata.component = this;
_shaderData.push_back(shaderdata);
// Tex unit is defined by shader
}