bool FWCamera::CreateRenderCamera(UINT32 uiWidth, UINT32 uiHeight, Format eFmtFrameBuffer /* = FMT_R32G32B32F */, bool bDepthBuffer /* = true */) { if(true == m_bLockedSurfaceViewport) {return false;} Device* pkDevice = m_pkGraphics->GetDevice(); // COMMENT : Create the render texture Surface* pkColorBuffer = NULL; if(CORE3D_FAILED(pkDevice->CreateSurface(&pkColorBuffer, uiWidth, uiHeight, eFmtFrameBuffer))) { return false; } // COMMENT : Create the depth texture Surface* pkDepthBuffer = NULL; if(true == bDepthBuffer) { if(CORE3D_FAILED(pkDevice->CreateSurface(&pkDepthBuffer, uiWidth, uiHeight, FMT_R32F))) { CORE3D_SAFE_RELEASE(pkColorBuffer); return false; } } // COMMENT : Set the view-port Matrix4x4 kMatViewport; Core3D::MatrixViewport(kMatViewport, 0, 0, uiWidth, uiHeight, 0.0f, 1.0f); m_pkRenderTarget->SetViewportMatrix(kMatViewport); m_pkRenderTarget->SetColorBuffer(pkColorBuffer); m_pkRenderTarget->SetDepthBuffer(pkDepthBuffer); CORE3D_SAFE_RELEASE(pkColorBuffer); CORE3D_SAFE_RELEASE(pkDepthBuffer); // COMMENT : Don't allow any more changes to surface / view-port m_bLockedSurfaceViewport = true; return true; }