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


C++ ProgramFactory::createPostProcess2DProgram方法代码示例

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


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

示例1: uniqueID

PostProcessor2DMultisample::PostProcessor2DMultisample(int32_t samples, GLenum internalFormat, bool fixedsamplelocations, int32_t blurPixel, float blurSigma, int32_t bloomPixel, float bloomSigma, int32_t maxRadiusCoC, float cocSigma, float aperture, float focal, float focusedObject) :
	PostProcessor(GL_TEXTURE_2D_MULTISAMPLE, blurPixel, blurSigma, bloomPixel, bloomSigma, maxRadiusCoC, cocSigma, aperture, focal, focusedObject), samples(samples), internalFormat(internalFormat), fixedsamplelocations(fixedsamplelocations)
{
	char buffer[256];
	sprintf(buffer, "%p", this);
	string uniqueID(buffer);

	dummy = Texture2DManager::getInstance()->createTexture("PostProcessor2DMultisampleDummy", GL_RGB, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, false, GL_NEAREST, GL_NEAREST, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE);

	// Main textures

	Texture2DMultisampleSP color0Texture2DMultisample = Texture2DMultisampleManager::getInstance()->createTexture("PostProcessor2DMultisample0" + uniqueID, samples, internalFormat, 1, 1, fixedsamplelocations);
	Texture2DMultisampleSP color1Texture2DMultisample = Texture2DMultisampleManager::getInstance()->createTexture("PostProcessor2DMultisample1" + uniqueID, samples, internalFormat, 1, 1, fixedsamplelocations);

	Texture2DMultisampleSP depthTexture2DMultisample = Texture2DMultisampleManager::getInstance()->createTexture("PostProcessor2DMultisampleDepth" + uniqueID, samples, GL_DEPTH_COMPONENT, 1, 1, fixedsamplelocations);

	FrameBuffer2DMultisampleSP frameBuffer2DMultisample = FrameBuffer2DMultisampleSP(new FrameBuffer2DMultisample(1, 1));
	frameBuffer2DMultisample->setColorAttachment0(color0Texture2DMultisample);
	frameBuffer2DMultisample->setColorAttachment1(color1Texture2DMultisample);
	frameBuffer2DMultisample->setDepthAttachment(depthTexture2DMultisample);

	FrameBuffer2DMultisampleManager::getInstance()->addFrameBuffer("PostProcessor2DMultisample" + uniqueID, frameBuffer2DMultisample, true);

	// Temporary

	Texture2DMultisampleSP tempColor0Texture2DMultisample = Texture2DMultisampleManager::getInstance()->createTexture("PostProcessor2DMultisampleTemp" + uniqueID, samples, internalFormat, 1, 1, fixedsamplelocations);

	FrameBuffer2DMultisampleSP tempFrameBuffer2DMultisample = FrameBuffer2DMultisampleSP(new FrameBuffer2DMultisample(1, 1));
	tempFrameBuffer2DMultisample->setColorAttachment0(tempColor0Texture2DMultisample);

	FrameBuffer2DMultisampleManager::getInstance()->addFrameBuffer("PostProcessor2DMultisampleTemp" + uniqueID, tempFrameBuffer2DMultisample, true);

	// Depth of Field textures ...

	Texture2DMultisampleSP depthOfFieldColor0Texture2DMultisample = Texture2DMultisampleManager::getInstance()->createTexture("PostProcessor2DMultisampleDepthOfField" + uniqueID, samples, internalFormat, 1, 1, fixedsamplelocations);

	FrameBuffer2DMultisampleSP depthOfFieldFrameBuffer2DMultisample = FrameBuffer2DMultisampleSP(new FrameBuffer2DMultisample(1, 1));
	depthOfFieldFrameBuffer2DMultisample->setColorAttachment0(depthOfFieldColor0Texture2DMultisample);

	FrameBuffer2DMultisampleManager::getInstance()->addFrameBuffer("PostProcessor2DMultisampleDepthOfField" + uniqueID, depthOfFieldFrameBuffer2DMultisample, true);

	// Bloom textures ...

	Texture2DMultisampleSP bloomColor0Texture2DMultisample = Texture2DMultisampleManager::getInstance()->createTexture("PostProcessor2DMultisampleBloom" + uniqueID, samples, internalFormat, 1, 1, fixedsamplelocations);

	FrameBuffer2DMultisampleSP bloomFrameBuffer2DMultisample = FrameBuffer2DMultisampleSP(new FrameBuffer2DMultisample(1, 1));
	bloomFrameBuffer2DMultisample->setColorAttachment0(bloomColor0Texture2DMultisample);

	FrameBuffer2DMultisampleManager::getInstance()->addFrameBuffer("PostProcessor2DMultisampleBloom" + uniqueID, bloomFrameBuffer2DMultisample, true);

	// Now pass to super class

	frameBuffer = static_cast<FrameBufferSP>(frameBuffer2DMultisample);
	tempFrameBuffer = static_cast<FrameBufferSP>(tempFrameBuffer2DMultisample);
	depthOfFieldFrameBuffer = static_cast<FrameBufferSP>(depthOfFieldFrameBuffer2DMultisample);
	bloomFrameBuffer = static_cast<FrameBufferSP>(bloomFrameBuffer2DMultisample);

	//

	screenTexture = u_screenTextureMS;
	depthTexture = u_depthTextureMS;
	bloomTexture = u_bloomTextureMS;

	//

	ProgramFactory programFactory;

	program = programFactory.createPostProcess2DProgram();

	GLUSshape rectangularPlane;
	glusShapeCreateRectangularPlanef(&rectangularPlane, 0.5f, 0.5f);

	numberIndices = rectangularPlane.numberIndices;

	glGenBuffers(1, &vboVertices);
	glBindBuffer(GL_ARRAY_BUFFER, vboVertices);
	glBufferData(GL_ARRAY_BUFFER, rectangularPlane.numberVertices * 4 * sizeof(GLfloat), (GLfloat*) rectangularPlane.vertices, GL_STATIC_DRAW);

	glGenBuffers(1, &vboTexCoords);
	glBindBuffer(GL_ARRAY_BUFFER, vboTexCoords);
	glBufferData(GL_ARRAY_BUFFER, rectangularPlane.numberVertices * 2 * sizeof(GLfloat), (GLfloat*) rectangularPlane.texCoords, GL_STATIC_DRAW);

	glGenBuffers(1, &vboIndices);
	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vboIndices);
	glBufferData(GL_ELEMENT_ARRAY_BUFFER, rectangularPlane.numberIndices * sizeof(GLuint), (GLuint*) rectangularPlane.indices, GL_STATIC_DRAW);

	postProcessorVAO = PostProcessorVAOSP(new PostProcessorVAO(program, *this));

	glusShapeDestroyf(&rectangularPlane);
}
开发者ID:EddyGun,项目名称:GraphicsEngine,代码行数:90,代码来源:PostProcessor2DMultisample.cpp


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