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


C++ Quad::renderWithAdditionalTextures方法代码示例

本文整理汇总了C++中Quad::renderWithAdditionalTextures方法的典型用法代码示例。如果您正苦于以下问题:C++ Quad::renderWithAdditionalTextures方法的具体用法?C++ Quad::renderWithAdditionalTextures怎么用?C++ Quad::renderWithAdditionalTextures使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Quad的用法示例。


在下文中一共展示了Quad::renderWithAdditionalTextures方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main


//.........这里部分代码省略.........

		//_______________________________________________________________________________________________________________________________________________________________________________
		// Acuumulation pass
		accumTransparencyRevealageShader->use();
		accumTransparencyRevealageShader->setUniform("VPMatrix", camera->getVPMatrix());

		model->setGLSLProgram(accumTransparencyRevealageShader);
		quad1->setGLSLProgram(*accumTransparencyRevealageShader);
		quad2->setGLSLProgram(*accumTransparencyRevealageShader);
		quad3->setGLSLProgram(*accumTransparencyRevealageShader);
		quad4->setGLSLProgram(*accumTransparencyRevealageShader);
		quad5->setGLSLProgram(*accumTransparencyRevealageShader);

		accumFrameBuffer->clean();
		accumFrameBuffer->bind();
		accumFrameBuffer->bindForRenderPass(activeColorAttachmentsTransparent);
		accumFrameBuffer->cleanColorAttachment(1,clearColorWhite);

		opaqueFrameBuffer->unbind();

		// Blitting the opaque scene depth to propperly depth test the transparen against it.
		opaqueFrameBuffer->bindForReading();

		accumFrameBuffer->bindForWriting();
		glBlitFramebuffer(0, 0, window->getWindowWidth(), window->getWindowHeight(), 0, 0, window->getWindowWidth(), window->getWindowHeight(), 
						  GL_DEPTH_BUFFER_BIT, GL_NEAREST);

		opaqueFrameBuffer->unbind();

		accumFrameBuffer->bind();
		accumFrameBuffer->bindForRenderPass(activeColorAttachmentsTransparent);

		glEnable(GL_BLEND);
		glBlendFunci(0, GL_ONE, GL_ONE);
		glBlendFunci(1, GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);
		//glEnable(GL_DEPTH_TEST);
		glDepthMask(GL_FALSE);
		glDisable(GL_CULL_FACE);

		model->renderTransparent();
		quad1->render();
		quad2->render();
		quad3->render();
		//quad4->render();
		//quad5->render();

		accumFrameBuffer->unbind();

		model->setGLSLProgram(defaultShader);
		quad1->setGLSLProgram(*defaultShader);
		quad2->setGLSLProgram(*defaultShader);
		quad3->setGLSLProgram(*defaultShader);
		quad4->setGLSLProgram(*defaultShader);
		quad5->setGLSLProgram(*defaultShader);

		glDisable(GL_BLEND);
		//glEnable(GL_DEPTH_TEST);
		glDepthMask(GL_TRUE);
		glEnable(GL_CULL_FACE);
		glCullFace(GL_BACK);

		//_______________________________________________________________________________________________________________________________________________________________________________
		// Final compositing pass

		//screenFillingQuad->setGLSLProgram(*screenFillingQuadShader);
		//screenFillingQuad->getCurrentShaderProgram()->use();
		//screenFillingQuad->renderWithAdditionalTextures(opaqueTextureHandle,sampler);

		newOITCoverageShader->use();

		glDepthMask(GL_FALSE);
		glEnable(GL_BLEND);
		glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);

		screenFillingQuad->renderWithAdditionalTextures(additionalTextureHandles,sampler);

		glDepthMask(GL_TRUE);
		glDisable(GL_BLEND);
		//_______________________________________________________________________________________________________________________________________________________________________________

		// For debug!
		//screenFillingQuad->setGLSLProgram(*screenFillingQuadShader);
		//screenFillingQuad->getCurrentShaderProgram()->use();
		//screenFillingQuad->setTexture(opaqueFrameBuffer->getColorAttachment(0));
		//screenFillingQuad->render();

		accumFrameBuffer->clean();

		window->swapBuffers();

		glfwPollEvents();

		check_gl_error();
	}

	glfwTerminate();
	window->release();
	
	return 0;
}
开发者ID:GregJo,项目名称:BA-Framework,代码行数:101,代码来源:Main.cpp


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