So I understand that this part handles the render to texture.
//render-to-texture
//set new render target
g_App.GetDevice()->SetRenderTarget(0,pRenderSurface);
//clear texture
g_App.GetDevice()->Clear(0,
NULL,
D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
D3DCOLOR_XRGB(100,100,100),
1.0f,
0);
g_App.GetDevice()->BeginScene();
g_App.GetDevice()->SetTexture(0,pPyramideTexture);
D3DXMatrixRotationY(&matRotationY,fRotation);
D3DXMatrixTranslation(&matTranslation,0.0f,0.0f,5.0f);
g_App.GetDevice()->SetTransform(D3DTS_WORLD,
&(matRotationY * matTranslation));
//set projection matrix
g_App.GetDevice()->SetTransform(D3DTS_PROJECTION,&matProjection);
g_App.GetDevice()->SetStreamSource(0,pTriangleVB,0,sizeof(D3DVERTEX));
g_App.GetDevice()->DrawPrimitive(D3DPT_TRIANGLELIST,0,4);
g_App.GetDevice()->EndScene();
Now I need to find a way to make this work for our own db Objects..