本文整理汇总了C++中CCamera::FrameBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ CCamera::FrameBuffer方法的具体用法?C++ CCamera::FrameBuffer怎么用?C++ CCamera::FrameBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCamera
的用法示例。
在下文中一共展示了CCamera::FrameBuffer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ApplyShadowMaps
void ApplyShadowMaps (short nStartSeg, fix nEyeOffset, int nWindow)
{
static float mTexBiasf [] = {
0.5f, 0.0f, 0.0f, 0.0f,
0.0f, 0.5f, 0.0f, 0.0f,
0.0f, 0.0f, 0.5f, 0.0f,
0.5f, 0.5f, 0.5f, 1.0f};
static float mPlanef [] = {
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f};
static GLenum nTexCoord [] = {GL_S, GL_T, GL_R, GL_Q};
CFloatMatrix mProjection;
CFloatMatrix mModelView;
int i;
CCamera *cameraP;
#if 1
ogl.SelectTMU (GL_TEXTURE0);
glEnable (GL_TEXTURE_2D);
glEnable (GL_TEXTURE_GEN_S);
glEnable (GL_TEXTURE_GEN_T);
glEnable (GL_TEXTURE_GEN_R);
glEnable (GL_TEXTURE_GEN_Q);
for (i = 0; i < 4; i++)
glTexGeni (nTexCoord [i], GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
for (i = 0; i < 4; i++)
glTexGenfv (nTexCoord [i], GL_EYE_PLANE, mPlanef + 4 * i);
glGetFloatv (GL_PROJECTION_MATRIX, mProjection.Vec ());
glMatrixMode (GL_TEXTURE);
for (i = 0, cameraP = gameData.render.shadows.shadowMaps; i < 1/*gameData.render.shadows.nShadowMaps*/; i++) {
glBindTexture (GL_TEXTURE_2D, cameraP->FrameBuffer ().RenderBuffer ());
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL);
glLoadMatrixf (mTexBiasf);
glMultMatrixf (mProjection.Vec ());
CFixMatrix::Transpose (mModelView, cameraP->GetObject ()->info.position.mOrient);
glMultMatrixf (mModelView.Vec ());
}
glMatrixMode (GL_MODELVIEW);
#endif
RenderMine (nStartSeg, nEyeOffset, nWindow);
#if 1
glMatrixMode (GL_TEXTURE);
glLoadIdentity ();
glMatrixMode (GL_MODELVIEW);
glDisable (GL_TEXTURE_GEN_S);
glDisable (GL_TEXTURE_GEN_T);
glDisable (GL_TEXTURE_GEN_R);
glDisable (GL_TEXTURE_GEN_Q);
ogl.SelectTMU (GL_TEXTURE0);
glDisable (GL_TEXTURE_2D);
#endif
DestroyShadowMaps ();
}