本文整理汇总了C++中CTexture::Disable方法的典型用法代码示例。如果您正苦于以下问题:C++ CTexture::Disable方法的具体用法?C++ CTexture::Disable怎么用?C++ CTexture::Disable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTexture
的用法示例。
在下文中一共展示了CTexture::Disable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
virtual void Update()
{
PROFILE("CAppTask::Update()", 1);
glClearColor(0.253f, 0.47f, 0.683f, 1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPolygonMode(GL_FRONT, m_nPolygonMode);
if(m_nPolygonMode == GL_FILL)
{
glDisable(GL_DEPTH_TEST);
m_tex.Enable();
m_shader.Enable();
m_shader.SetUniformParameter1i("s3Tex0", 0);
}
CSRTTransform camera = CCameraTask::GetPtr()->GetCamera();
float fDistance[2];
fDistance[0] = camera.GetPosition().Distance(m_cSphere.GetPosition());
fDistance[1] = camera.GetPosition().Distance(m_cSphere2.GetPosition());
if(fDistance[0] > fDistance[1])
{
m_cSphere.Draw(camera, m_tex);
m_cSphere2.Draw(camera, m_tex);
}
else
{
m_cSphere2.Draw(camera, m_tex);
m_cSphere.Draw(camera, m_tex);
}
glEnable(GL_DEPTH_TEST);
m_shader.Disable();
m_tex.Disable();
glPolygonMode(GL_FRONT, GL_FILL);
}
示例2: Update
virtual void Update()
{
PROFILE("CAppTask::Update()", 1);
glClearColor(0.253f, 0.47f, 0.683f, 1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPolygonMode(GL_FRONT, m_nPolygonMode);
if(m_nPolygonMode == GL_FILL)
{
glEnable(GL_BLEND);
glDepthFunc(GL_ALWAYS);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(1, 1, 1, 1);
m_tex.Enable();
}
CSRTTransform camera = CCameraTask::GetPtr()->GetCamera();
int i, j;
#define LEVEL 10
const int nCubes = LEVEL*LEVEL*LEVEL;
CProjectedCube cube[nCubes];
float fDistance[nCubes];
for(i=0; i<nCubes; i++)
{
cube[i].SetPosition(CVector(i/(LEVEL*LEVEL)*2, ((i/LEVEL)%LEVEL)*2, (i%LEVEL)*2));
fDistance[i] = cube[i].GetPosition().Distance(camera.GetPosition());
}
int nOrder[nCubes];
for(i=0; i<nCubes; i++)
nOrder[i] = i;
for(i=0; i<nCubes; i++)
{
for(j=0; j<nCubes-i-1; j++)
{
if(fDistance[nOrder[j]] > fDistance[nOrder[j+1]])
{
int nTemp = nOrder[j];
nOrder[j] = nOrder[j+1];
nOrder[j+1] = nTemp;
}
}
}
for(i=0; i<nCubes; i++)
cube[nOrder[nCubes-1-i]].DrawVolume(camera);
m_tex.Disable();
glDisable(GL_BLEND);
glPolygonMode(GL_FRONT, GL_FILL);
}
示例3: Update
virtual void Update()
{
PROFILE("CAppTask::Update()", 1);
if(m_bHDR && m_fb.IsValid())
m_fb.EnableFrameBuffer();
// Cheap collision detection/response
CVector vCamera = CCameraTask::GetPtr()->GetPosition();
if(vCamera.Magnitude() < m_fInnerRadius + 0.01f)
{
CVector N = vCamera / vCamera.Magnitude();
CVector I = CCameraTask::GetPtr()->GetVelocity();
float fSpeed = I.Magnitude();
I /= fSpeed;
CVector R = N * (2.0*(-I | N)) + I;
CCameraTask::GetPtr()->SetVelocity(R * fSpeed);
vCamera = N * (m_fInnerRadius + 0.01f);
CCameraTask::GetPtr()->SetPosition(vCamera);
}
CVector vUnitCamera = vCamera / vCamera.Magnitude();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPolygonMode(GL_FRONT, m_nPolygonMode);
// Draw the groud sphere
CGLShaderObject *pGroundShader;
if(vCamera.Magnitude() >= m_fOuterRadius)
pGroundShader = &m_shGroundFromSpace;
else
pGroundShader = &m_shGroundFromAtmosphere;
pGroundShader->Enable();
pGroundShader->SetUniformParameter3f("v3CameraPos", vCamera.x, vCamera.y, vCamera.z);
pGroundShader->SetUniformParameter3f("v3LightPos", m_vLightDirection.x, m_vLightDirection.y, m_vLightDirection.z);
pGroundShader->SetUniformParameter3f("v3InvWavelength", 1/m_fWavelength4[0], 1/m_fWavelength4[1], 1/m_fWavelength4[2]);
pGroundShader->SetUniformParameter1f("fCameraHeight", vCamera.Magnitude());
pGroundShader->SetUniformParameter1f("fCameraHeight2", vCamera.MagnitudeSquared());
pGroundShader->SetUniformParameter1f("fInnerRadius", m_fInnerRadius);
pGroundShader->SetUniformParameter1f("fInnerRadius2", m_fInnerRadius*m_fInnerRadius);
pGroundShader->SetUniformParameter1f("fOuterRadius", m_fOuterRadius);
pGroundShader->SetUniformParameter1f("fOuterRadius2", m_fOuterRadius*m_fOuterRadius);
pGroundShader->SetUniformParameter1f("fKrESun", m_Kr*m_ESun);
pGroundShader->SetUniformParameter1f("fKmESun", m_Km*m_ESun);
pGroundShader->SetUniformParameter1f("fKr4PI", m_Kr4PI);
pGroundShader->SetUniformParameter1f("fKm4PI", m_Km4PI);
pGroundShader->SetUniformParameter1f("fScale", 1.0f / (m_fOuterRadius - m_fInnerRadius));
pGroundShader->SetUniformParameter1f("fScaleDepth", m_fRayleighScaleDepth);
pGroundShader->SetUniformParameter1f("fScaleOverScaleDepth", (1.0f / (m_fOuterRadius - m_fInnerRadius)) / m_fRayleighScaleDepth);
pGroundShader->SetUniformParameter1f("g", m_g);
pGroundShader->SetUniformParameter1f("g2", m_g*m_g);
pGroundShader->SetUniformParameter1i("nSamples", m_nSamples);
pGroundShader->SetUniformParameter1f("fSamples", m_nSamples);
pGroundShader->SetUniformParameter1i("s2Test", 0);
GLUquadricObj *pSphere = gluNewQuadric();
//m_tEarth.Enable();
gluSphere(pSphere, m_fInnerRadius, 100, 50);
//m_tEarth.Disable();
gluDeleteQuadric(pSphere);
pGroundShader->Disable();
// Draw the sky sphere
CGLShaderObject *pSkyShader;
if(vCamera.Magnitude() >= m_fOuterRadius)
pSkyShader = &m_shSkyFromSpace;
else
pSkyShader = &m_shSkyFromAtmosphere;
pSkyShader->Enable();
pSkyShader->SetUniformParameter3f("v3CameraPos", vCamera.x, vCamera.y, vCamera.z);
pSkyShader->SetUniformParameter3f("v3LightPos", m_vLightDirection.x, m_vLightDirection.y, m_vLightDirection.z);
pSkyShader->SetUniformParameter3f("v3InvWavelength", 1/m_fWavelength4[0], 1/m_fWavelength4[1], 1/m_fWavelength4[2]);
pSkyShader->SetUniformParameter1f("fCameraHeight", vCamera.Magnitude());
pSkyShader->SetUniformParameter1f("fCameraHeight2", vCamera.MagnitudeSquared());
pSkyShader->SetUniformParameter1f("fInnerRadius", m_fInnerRadius);
pSkyShader->SetUniformParameter1f("fInnerRadius2", m_fInnerRadius*m_fInnerRadius);
pSkyShader->SetUniformParameter1f("fOuterRadius", m_fOuterRadius);
pSkyShader->SetUniformParameter1f("fOuterRadius2", m_fOuterRadius*m_fOuterRadius);
pSkyShader->SetUniformParameter1f("fKrESun", m_Kr*m_ESun);
pSkyShader->SetUniformParameter1f("fKmESun", m_Km*m_ESun);
pSkyShader->SetUniformParameter1f("fKr4PI", m_Kr4PI);
pSkyShader->SetUniformParameter1f("fKm4PI", m_Km4PI);
pSkyShader->SetUniformParameter1f("fScale", 1.0f / (m_fOuterRadius - m_fInnerRadius));
pSkyShader->SetUniformParameter1f("fScaleDepth", m_fRayleighScaleDepth);
pSkyShader->SetUniformParameter1f("fScaleOverScaleDepth", (1.0f / (m_fOuterRadius - m_fInnerRadius)) / m_fRayleighScaleDepth);
pSkyShader->SetUniformParameter1f("g", m_g);
pSkyShader->SetUniformParameter1f("g2", m_g*m_g);
pSkyShader->SetUniformParameter1i("nSamples", m_nSamples);
pSkyShader->SetUniformParameter1f("fSamples", m_nSamples);
m_tOpticalDepth.Enable();
pSkyShader->SetUniformParameter1f("tex", 0);
glFrontFace(GL_CW);
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE);
pSphere = gluNewQuadric();
gluSphere(pSphere, m_fOuterRadius, 100, 100);
gluDeleteQuadric(pSphere);
glDisable(GL_BLEND);
glFrontFace(GL_CCW);
m_tOpticalDepth.Disable();
pSkyShader->Disable();
//.........这里部分代码省略.........