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


C++ DrawBuffer::getVAOName方法代码示例

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


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

示例1: drawColour

void GameRenderer::drawColour(const glm::vec4& colour, glm::vec4 extents)
{
	glUseProgram(ssRectProgram);

	// Move into NDC
	extents.x /= renderer->getViewport().x;
	extents.y /= renderer->getViewport().y;
	extents.z /= renderer->getViewport().x;
	extents.w /= renderer->getViewport().y;
	extents.x += extents.z / 2.f;
	extents.y += extents.w / 2.f;
	extents.x -= .5f;
	extents.y -= .5f;
	extents *= glm::vec4(2.f,-2.f, 1.f, 1.f);

	glEnable(GL_BLEND);
	glUniform2f(ssRectOffset, extents.x, extents.y);
	glUniform2f(ssRectSize, extents.z, extents.w);

	glActiveTexture(GL_TEXTURE0);
	glBindTexture(GL_TEXTURE_2D, 0);
	glUniform1i(ssRectTexture, 0);
	glUniform4f(ssRectColour, colour.r, colour.g, colour.b, colour.a);

	glBindVertexArray( ssRectDraw.getVAOName() );
	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

	// Ooops
	renderer->invalidate();
}
开发者ID:ezhangle,项目名称:openrw,代码行数:30,代码来源:GameRenderer.cpp

示例2: renderLetterbox

void GameRenderer::renderLetterbox()
{
	glUseProgram(ssRectProgram);
	const float cinematicExperienceSize = 0.15f;
	glUniform2f(ssRectOffset, 0.f, -1.f * (1.f - cinematicExperienceSize));
	glUniform2f(ssRectSize, 1.f, cinematicExperienceSize);

	glBindTexture(GL_TEXTURE_2D, 0);
	glUniform1i(ssRectTexture, 0);
	glUniform4f(ssRectColour, 0.f, 0.f, 0.f, 1.f);

	glBindVertexArray( ssRectDraw.getVAOName() );
	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

	glUniform2f(ssRectOffset, 0.f, 1.f * (1.f - cinematicExperienceSize));
	glUniform2f(ssRectSize, 1.f, cinematicExperienceSize);

	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
开发者ID:ezhangle,项目名称:openrw,代码行数:19,代码来源:GameRenderer.cpp

示例3: renderWorld


//.........这里部分代码省略.........
				dp.diffuse = 1.f;

				renderer->draw( model, &geom->dbuff, dp );
			}
		}
	}

	// Draw goal indicators
	glDepthMask(GL_FALSE);
	renderer->useProgram( particleProg );
	for(auto& i : world->getAreaIndicators())
	{
		renderAreaIndicator( &i );
	}
	glDepthMask(GL_TRUE);

	renderer->pushDebugGroup("Water");

	water.render(this, world);

	profWater = renderer->popDebugGroup();

	renderer->pushDebugGroup("Sky");

	glBindVertexArray( vao );

	Renderer::DrawParameters dp;
	dp.start = 0;
	dp.count = skydomeSegments * skydomeRows * 6;

	renderer->useProgram(skyProg);
	renderer->setUniform(skyProg, "TopColor", glm::vec4(skyTop, 1.f));
	renderer->setUniform(skyProg, "BottomColor", glm::vec4(skyBottom, 1.f));

	renderer->draw(glm::mat4(), &skyDbuff, dp);

	profSky = renderer->popDebugGroup();

	renderer->pushDebugGroup("Effects");
	renderEffects(world);
	profEffects = renderer->popDebugGroup();

	glDisable(GL_DEPTH_TEST);

	GLuint splashTexName = 0;
	auto fc = world->state->fadeColour;
	if((fc.r + fc.g + fc.b) == 0 && world->state->currentSplash.size() > 0) {
		auto splash = world->data->findTexture(world->state->currentSplash);
		if ( splash )
		{
			splashTexName = splash->getName();
		}
	}

	if( (world->state->isCinematic || world->state->currentCutscene ) && splashTexName != 0 ) {
		renderLetterbox();
	}

	float fadeTimer = world->getGameTime() - world->state->fadeStart;
	if( fadeTimer < world->state->fadeTime || !world->state->fadeOut ) {
		glUseProgram(ssRectProgram);
		glUniform2f(ssRectOffset, 0.f, 0.f);
		glUniform2f(ssRectSize, 1.f, 1.f);

		glUniform1i(ssRectTexture, 0);

		if(splashTexName != 0) {
			glBindTexture(GL_TEXTURE_2D, splashTexName);
			fc = glm::u16vec3(0, 0, 0);
		}
		else {
			glBindTexture(GL_TEXTURE_2D, 0);
		}

		float fadeFrac = 0.f;
		if( world->state->fadeTime > 0.f ) {
			fadeFrac = std::min(fadeTimer / world->state->fadeTime, 1.f);
		}

		float a = world->state->fadeOut ? 1.f - fadeFrac : fadeFrac;

		glm::vec4 fadeNormed(fc.r / 255.f, fc.g/ 255.f, fc.b/ 255.f, a);

		glUniform4fv(ssRectColour, 1, glm::value_ptr(fadeNormed));

		glBindVertexArray( ssRectDraw.getVAOName() );
		glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
	}

	if( (world->state->isCinematic || world->state->currentCutscene ) && splashTexName == 0 ) {
		renderLetterbox();
	}

	renderPostProcess();

	glUseProgram(0);
	glBindBuffer(GL_ARRAY_BUFFER, 0);
	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
	glBindVertexArray( 0 );
}
开发者ID:ezhangle,项目名称:openrw,代码行数:101,代码来源:GameRenderer.cpp


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