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


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

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


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

示例1: BlurHDR

void BaseApp::BlurHDR()
{
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, g_frameBuffer);
	glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, g_texHDR.GetID(), 0);
	glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, g_depthRenderBufferHDR);

	glViewport(0, 0, m_width / 1, m_height / 1);
	glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
	glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

	glBindTexture(GL_TEXTURE_2D, g_texFP16.GetID());
	m_shdHDR->enable();
	RenderScreenCoveringQuad();
	m_shdHDR->disable();

	glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, g_renderBufferBlurdHDR);
	glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, g_texHBluredHDR.GetID(), 0);
			
	glViewport(0, 0, m_width / 4, m_height / 4);

	m_shdBlur->enable();

	g_texHDR.Activate(0);
	m_shdBlur->sendUniform2f("blur_offset",  blurOffset, 0.0f);
	RenderScreenCoveringQuad();
	g_texHDR.Deactivate();

	glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, g_texVBluredHDR.GetID(), 0);

	g_texHBluredHDR.Activate(0);
	m_shdBlur->sendUniform2f("blur_offset", blurOffset/2.0f, 0.0f);
	RenderScreenCoveringQuad();
	g_texHBluredHDR.Deactivate();



	glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, g_texHBluredHDR.GetID(), 0);

	g_texVBluredHDR.Activate(0);
	m_shdBlur->sendUniform2f("blur_offset", 0.0f, blurOffset);
	RenderScreenCoveringQuad();
	g_texVBluredHDR.Deactivate();

	glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, g_texVBluredHDR.GetID(), 0);
	
	g_texHBluredHDR.Activate(0);
	m_shdBlur->sendUniform2f("blur_offset", 0.0f, blurOffset/2.0f);
	RenderScreenCoveringQuad();
	g_texHBluredHDR.Deactivate();


	m_shdBlur->disable();


	glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 );
	glViewport(0, 0, m_width, m_height);
}
开发者ID:pedroedrasousa,项目名称:opengl-stuff-cpp,代码行数:57,代码来源:Main.cpp

示例2:

void
TileBatch::Flush (const Texture& texture)
{
    // Sanity check the same VBO is bound throughout the draw call
    RDGE_ASSERT(m_vbo == static_cast<uint32>(opengl::GetInt(GL_ARRAY_BUFFER_BINDING)));

    opengl::ReleaseBufferPointer(GL_ARRAY_BUFFER);
    opengl::UnbindBuffers(GL_ARRAY_BUFFER);

    if (m_submissions > 0)
    {
        texture.Activate();
        this->blend.Apply();

        opengl::BindVertexArray(m_vao);
        opengl::BindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ibo);

        opengl::DrawElements(GL_TRIANGLES, static_cast<uint32>(m_submissions * 6), GL_UNSIGNED_INT, nullptr);

        opengl::UnbindBuffers(GL_ELEMENT_ARRAY_BUFFER);
        opengl::UnbindVertexArrays();
    }
}
开发者ID:JoshBramlett,项目名称:RDGE,代码行数:23,代码来源:tile_batch.cpp

示例3: RenderFrame

void BaseApp::RenderFrame()
{	
	m_fpsCounter.MarkFrameStart();

	POINT mousePos;
	GetCursorPos(&mousePos);

	m_mouseX = mousePos.x - m_winPosX;
	m_mouseY = mousePos.y - m_winPosY;

	if(lockMouse)
	{
		m_camera.SetViewByMouse( float(m_mouseLockedX - m_mouseX) * 0.2f , float(m_mouseLockedY - m_mouseY) * 0.2f);	
		CenterMouse();
	}

	float height = g_heightMap->GetInterpolatedHeight(m_camera.m_vEye.x, m_camera.m_vEye.z);

	//if( m_camera.m_vEye.y <= height + 2.0f )
	{
		float oldY = m_camera.m_vEye.y;
		m_camera.m_vEye.y = height + 12.0f;
		float newY = m_camera.m_vEye.y;
		m_camera.m_vCenter.y += newY - oldY;
	}

	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, g_frameBuffer);
	glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, g_texFP16.GetID(), 0);
	glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, g_renderBuffer[0]);

	glClearColor(0.8f, 1.0f, 0.8f, 1.0f);
	glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);	

	m_camera.BuildViewMatrix(&modelViewMat);
	glLoadMatrixf(modelViewMat);


	if(!m_freezeFrustum)
		frustum.ComputeFrustum(projMat, modelViewMat);

	glPushMatrix();
	glTranslatef(m_camera.m_vEye.x, m_camera.m_vEye.y, m_camera.m_vEye.z);
	glDepthMask(GL_FALSE);
	m_shdSky->enable();
	m_shdSky->sendUniform3f("color1", 2.0f, 2.0f, 2.0f);
	m_shdSky->sendUniform3f("color2", 0.5f, 0.7f, 2.0f);
	m_skydome.Render();
	m_shdSky->disable();
	//glDepthMask(GL_TRUE);
	glPopMatrix();




	Vec3 sunPos = m_sunPos * 500.0f;
	glPopMatrix();
	glPushMatrix();
	glTranslatef(m_camera.m_vEye.x + sunPos.x, m_camera.m_vEye.y + sunPos.y, m_camera.m_vEye.z + sunPos.z);
	m_texSun.Activate(0);
	m_shdSimpleColor->enable();
	m_shdSimpleColor->sendUniform3f("color", 4.0f, 4.0f, 2.0f);
	glEnable(GL_BLEND );
	glBlendFunc(GL_SRC_COLOR, GL_ONE);
	RenderSprite(2000, &m_camera.m_vEye, modelViewMat);
	glDisable(GL_BLEND );
	m_shdSimpleColor->disable();
	m_texSun.Deactivate();


glDepthMask(GL_TRUE);
	glPopMatrix();



	g_quadtree->Render(frustum, m_camera.m_vEye);
/*
	glAlphaFunc(GL_GREATER,0.5f);
	glEnable(GL_ALPHA_TEST);
	Mat4 tmp;

	tmp.Identity();
	tmp.Translate(Vec3(0.0f, g_heightMap->GetInterpolatedHeight(0.0f, 0.0f), 0.0f));
	model.render(tmp, &frustum);

	tmp.Identity();
	tmp.Translate(Vec3(50.0f, g_heightMap->GetInterpolatedHeight(50.0f, 0.0f), 0.0f));
	model.render(tmp, &frustum);

	tmp.Identity();
	tmp.Translate(Vec3(0.0f, g_heightMap->GetInterpolatedHeight(0.0f, 100.0f), 100.0f));
	model.render(tmp, &frustum);

	tmp.Identity();
	tmp.Translate(Vec3(-50.0f, g_heightMap->GetInterpolatedHeight(-50.0f, -200.0f), -200.0f));
	model.render(tmp, &frustum);

	glDisable(GL_ALPHA_TEST);

*/

//.........这里部分代码省略.........
开发者ID:pedroedrasousa,项目名称:opengl-stuff-cpp,代码行数:101,代码来源:Main.cpp


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