当前位置: 首页>>代码示例>>C++>>正文


C++ Texture::GetId方法代码示例

本文整理汇总了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();
}
开发者ID:jjiezheng,项目名称:lfant,代码行数:61,代码来源:FrameBuffer.cpp


注:本文中的Texture::GetId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。