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


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

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


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

void Object3DS::loadTexture()
{
	glEnable(GL_TEXTURE_2D);

	Texture* texture = new Texture();
	if (texture->Load(textureName, 512, 512))
	{
		glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
		glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
		object.id_texture = texture->GetID();
	}
	else
	{
		object.id_texture = NULL;
	}
	glDisable(GL_TEXTURE_2D);
}
开发者ID:tomitar,项目名称:AGEC_Sem2_Handin,代码行数:17,代码来源:Object3DS.cpp

示例3: GLCHECK

_JATTA_EXPORT void Jatta::OpenGL::FrameBuffer::Texture2D(Enum attachment, Enum textureTarget, Texture texture, SInt32 level)
{
    glFramebufferTexture2D(type, attachment, textureTarget, texture.GetID(), level);
    GLCHECK("Failed to attach texture 2D to frame buffer.");
}
开发者ID:JoshuaBrookover,项目名称:Jatta,代码行数:5,代码来源:FrameBuffer.cpp

示例4:

JNIEXPORT jint JNICALL Java_sp_graphics_Texture_native_1getID
(JNIEnv *env, jclass cls, jlong handler) {
	Texture* texture = getHandle<Texture>(handler);
	return texture->GetID();
}
开发者ID:Itay2805,项目名称:Sparky4j-core,代码行数:5,代码来源:sp_graphics_Texture.cpp

示例5: 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

示例6: RenderUnderwaterNormalMap

void BaseApp::RenderUnderwaterNormalMap()
{
	glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, g_texWaterReflect.GetID(), 0 );
	glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, g_depthRenderBuffer2 );

	glViewport( 0, 0, 512, 512 );

	glMatrixMode(GL_PROJECTION);
	glLoadMatrixf(projMat);
	glMatrixMode(GL_MODELVIEW);


	glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

glDepthMask(GL_FALSE);
glDisable(GL_DEPTH_TEST);

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

	glScalef(1.0f, -1.0f, 1.0f);
	glFrontFace(GL_CW);


	glActiveTextureARB(GL_TEXTURE0_ARB);
	glEnable(GL_TEXTURE_CUBE_MAP_ARB);
	glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, m_texCubeUnderwaterNormMap.GetID());

	static float a = 0.0f;
	a+=0.02f;
	glPushMatrix();
	glTranslatef(m_camera.m_vEye.x, -m_camera.m_vEye.y - 500, m_camera.m_vEye.z);
	glDepthMask(GL_FALSE);


	glMatrixMode(GL_TEXTURE);
	glPushMatrix();
	glLoadIdentity();
	//glTranslatef(a, 0.0f, 0.0f);
	glRotatef(a, 0.0f, 5.0f, 5.0f);

	m_skydome.RenderCubeMap();

	glRotatef(-2*a, 0.5f, 0.5f, 0.0f);
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	glColor4f(1.0f, 1.0f, 1.0f, 0.5f);
	m_skydome.RenderCubeMap();
	glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
	glDisable(GL_BLEND);



	glMatrixMode(GL_TEXTURE);
	glPopMatrix();
    glMatrixMode(GL_MODELVIEW);


	glDepthMask(GL_TRUE);
	glPopMatrix();

	glDisable(GL_TEXTURE_CUBE_MAP_ARB);

glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);

	glViewport( 0, 0, m_width, m_height);

	glFrontFace(GL_CCW);
}
开发者ID:pedroedrasousa,项目名称:opengl-stuff-cpp,代码行数:71,代码来源:Main.cpp

示例7: RenderWaterReflection

void BaseApp::RenderWaterReflection()
{
	glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, g_texWaterReflect.GetID(), 0 );
	glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, g_depthRenderBuffer2 );

	glViewport( 0, 0, 512, 512 );

	glMatrixMode(GL_PROJECTION);
	glLoadMatrixf(projMat);
	glMatrixMode(GL_MODELVIEW);


	glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );


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

	glScalef(1.0f, -1.0f, 1.0f);
	glFrontFace(GL_CW);


	glPushMatrix();
	glTranslatef(m_camera.m_vEye.x, -m_camera.m_vEye.y - 500, m_camera.m_vEye.z);
	glDepthMask(GL_FALSE);
	m_shdSky->enable();
	m_shdSky->sendUniform3f("color1", 25.5f, 25.5f, 38.0f);
	m_shdSky->sendUniform3f("color2", 0.5f, 0.8f, 1.0f);
	m_skydome.Render();
	m_shdSky->disable();
	glDepthMask(GL_TRUE);
	glPopMatrix();


	g_quadtree->SetRenderFoliageFlag(false);
	g_quadtree->RenderStaticLOD(frustum, m_camera.m_vEye, 3);
	g_quadtree->SetRenderFoliageFlag(true);

	glViewport( 0, 0, m_width, m_height);

	glFrontFace(GL_CCW);
}
开发者ID:pedroedrasousa,项目名称:opengl-stuff-cpp,代码行数:43,代码来源:Main.cpp


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