本文整理汇总了C++中Texture::GetId方法的典型用法代码示例。如果您正苦于以下问题:C++ Texture::GetId方法的具体用法?C++ Texture::GetId怎么用?C++ Texture::GetId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Texture
的用法示例。
在下文中一共展示了Texture::GetId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
void FrameBuffer::Init()
{
glGenFramebuffers(1, &id);
glBindFramebuffer(GL_FRAMEBUFFER, id);
// GetGame()->Log(glGetError());
drawBuffers.clear();
Texture* tex = nullptr;
if(textures.size() > 0)
{
for(uint i = 0; i < textures.size(); ++i)
{
tex = textures[i];
// tex->scaleFilter = Texture::ScaleFilter::Linear;
tex->wrapMode = Texture::WrapMode::Clamp;
// tex->mode = GL_TEXTURE_2D_MULTISAMPLE;
tex->size = uvec2(rect.width, rect.height);
tex->SetIndex(startIndex+i);
tex->InitData(0);
uint32 attachment = startIndex+GL_COLOR_ATTACHMENT0+i;
GetGame()->Log("Setting up textures for FrameBuffer, tex ", i, " gets attachment ", attachment, ". GL_COLOR_ATTACHMENT0 = ", GL_COLOR_ATTACHMENT0);
tex->Bind();
glFramebufferTexture2D(GL_FRAMEBUFFER, attachment, tex->GetMode(), tex->GetId(), 0);
drawBuffers.push_back(attachment);
}
}
if(hasDepth)
{
/* glGenRenderbuffers(1, &depthBuffer);
glBindRenderbuffer(GL_RENDERBUFFER, depthBuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, rect.width, rect.height);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, depthBuffer);
*/
if(depthTexture)
{
// depthTexture->SetFormat(Texture::Format::Depth32F_Stencil8, Texture::Format::Depth);
depthTexture->SetFormat(Texture::Format::Depth32F, Texture::Format::Depth);
depthTexture->wrapMode = Texture::WrapMode::Clamp;
depthTexture->dataType = Texture::DataType::Float;
depthTexture->size = uvec2(rect.width, rect.height);
depthTexture->SetIndex(startIndex+textures.size());
depthTexture->InitData(0);
depthTexture->Bind();
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, depthTexture->GetMode(), depthTexture->GetId(), 0);
GetGame()->Log(glGetError());
}
}
DrawBuffers();
BeginRender();
Unbind();
}