本文整理汇总了C++中CTexture::preRenderToTexture方法的典型用法代码示例。如果您正苦于以下问题:C++ CTexture::preRenderToTexture方法的具体用法?C++ CTexture::preRenderToTexture怎么用?C++ CTexture::preRenderToTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTexture
的用法示例。
在下文中一共展示了CTexture::preRenderToTexture方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renderOffScreen
void CTargetingComputer::renderOffScreen()
{
// Perform offscreen rendering
CTexture* pTexture = g_oTextureManager.texture(m_auiOffScreenTexture);
pTexture->preRenderToTexture();
// Clear screen
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Calculate direction vector
CVector3 vecTarget = m_pTarget->m_ppMasses[0]->m_vecPos - m_pPlayerShip->m_ppMasses[0]->m_vecPos;
float fRange = vecTarget.length();
float fSize = m_pTarget->m_oModel.boundingSphere().m_fRadius;
// Set Projection Matrix
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
//gluPerspective(fAngle,1.0f,fRange-fSize, fRange+fSize);
glOrtho(-fSize,fSize,-fSize,fSize,fRange-fSize,fRange+fSize);
// Set Modelview Matrix
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(m_pPlayerShip->m_ppMasses[0]->m_vecPos.X(),
m_pPlayerShip->m_ppMasses[0]->m_vecPos.Y(),
m_pPlayerShip->m_ppMasses[0]->m_vecPos.Z(),
m_pTarget->m_ppMasses[0]->m_vecPos.X(),
m_pTarget->m_ppMasses[0]->m_vecPos.Y(),
m_pTarget->m_ppMasses[0]->m_vecPos.Z(),
m_pPlayerShip->m_vecUp.X() - m_pPlayerShip->m_ppMasses[0]->m_vecPos.X(),
m_pPlayerShip->m_vecUp.Y() - m_pPlayerShip->m_ppMasses[0]->m_vecPos.Y(),
m_pPlayerShip->m_vecUp.Z() - m_pPlayerShip->m_ppMasses[0]->m_vecPos.Z());
// Draw
glDisable(GL_TEXTURE_2D);
m_pTarget->draw(false);
glEnable(GL_TEXTURE_2D);
// Finish up
pTexture->postRenderToTexture(GL_RGBA);
}