예제 #1
0
void FrameBufferObject::End(GraphicsState & glstate, std::ostream & error_output)
{
	CheckForOpenGLErrors("start of FBO end", error_output);

	if (singlesample_framebuffer_object)
	{
		glstate.BindFramebuffer(GL_READ_FRAMEBUFFER, framebuffer_object);
		glstate.BindFramebuffer(GL_DRAW_FRAMEBUFFER, singlesample_framebuffer_object->framebuffer_object);

		assert(glCheckFramebufferStatus(GL_READ_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE);
		assert(glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE);

		CheckForOpenGLErrors("FBO end multisample binding", error_output);

		const int w = singlesample_framebuffer_object->GetWidth();
		const int h = singlesample_framebuffer_object->GetHeight();
		glBlitFramebuffer(0, 0, w, h, 0, 0, w, h, GL_COLOR_BUFFER_BIT, GL_NEAREST);

		CheckForOpenGLErrors("FBO end multisample blit", error_output);
	}

	CheckForOpenGLErrors("FBO multisample blit", error_output);

	// optionally rebuild mipmaps
	for (std::vector <FrameBufferTexture*>::const_iterator i = textures.begin(); i != textures.end(); i++)
	{
		if ((*i)->HasMipMap())
		{
			glstate.BindTexture(0, (*i)->GetTarget(), (*i)->GetId());
			glGenerateMipmap((*i)->GetTarget());
			glstate.BindTexture(0, (*i)->GetTarget(), 0);
		}
	}

	CheckForOpenGLErrors("end of FBO end", error_output);
}
예제 #2
0
void RenderInputScene::SetTextures(
	GraphicsState & glstate,
	const std::vector <TextureInterface*> & textures,
	std::ostream & error_output)
{
	for (unsigned i = 0; i < textures.size(); i++)
	{
		if (textures[i])
		{
			glstate.BindTexture(i, textures[i]->GetTarget(), textures[i]->GetId());

			if (CheckForOpenGLErrors("RenderDrawlists extra texture bind", error_output))
			{
				error_output << "this error occurred while binding texture " << i << " id=" << textures[i]->GetId() << std::endl;
			}
		}
	}
}
예제 #3
0
void RenderInputScene::SetTextures(const Drawable & d, GraphicsState & glstate)
{
	glstate.BindTexture(0, GL_TEXTURE_2D, d.GetTexture0());
	glstate.BindTexture(1, GL_TEXTURE_2D, d.GetTexture1());
	glstate.BindTexture(2, GL_TEXTURE_2D, d.GetTexture2());
}