03-20-2019 01:27 PM
03-26-2019 12:52 PM
PlatformCore::PlatformCore(Application *app)
{
pApp = app;
pApp->SetPlatformCore(this);
StartupSeconds = OVR::Timer::GetSeconds();
}
// following are at the Application class level
pApp->SetPlatformCore(this);
class PlatformCore* pPlatform=pApp;
RenderDevice* pRender = pPlatform->SetupGraphics(Session, OVR_DEFAULT_RENDER_DEVICE_SET,
graphics, RenderParams, luid);
ID3D11Device *deviceD3D= ((OVR::Render::D3D11::RenderDevice*)pRender)->Device;
struct RenderTarget // from class Texture : public RefCountBase<Texture>
{
Ptr<Texture> pColorTex;
Ptr<Texture> pDepthTex;
Sizei Size;
};
RenderTarget RenderTargets[Rendertarget_LAST]; // [3]
RenderTarget* DrawEyeTargets[Rendertarget_LAST]; // the buffers we'll actually render to
ovrTextureSwapChain oTSC[2]; // one for color and one for depth
oTSC[0] = DrawEyeTargets[0]->pColorTex->Get_ovrTextureSet();
int swapChainLength = 0;
ovr_GetTextureSwapChainLength(Session, oTSC[0], &swapChainLength);
int currentIndex = 0;
ovr_GetTextureSwapChainCurrentIndex(Session, oTSC[0], ¤tIndex);
int workingIndex = (currentIndex + 1) % swapChainLength;
ID3D11Texture2D *dxColorbuffer;
ID3D11Texture2D *dxDepthbuffer;
ovr_GetTextureSwapChainBufferDX(Session, oTSC[0], workingIndex, IID_ID3D11Texture2D,
(void **)&dxColorbuffer);
wglDXOpenDeviceNVFunc = (PFNWGLDXOPENDEVICENVPROC)wglGetProcAddress("wglDXOpenDeviceNV"); // etc
HANDLE m_hInteropDevice = wglDXOpenDeviceNVFunc((void *)deviceD3D);
GLuint m_gltextures[2] = { 0,0 }; // color and depth buffers as Texture2D
HANDLE m_hInteropObjects[2] = { 0,0 }; // color and depth buffers as Texture2D
glGenTextures(2, m_gltextures);
m_hInteropObjects[0] = wglDXRegisterObjectNV(m_hInteropDevice, dxColorbuffer,
m_gltextures[0],
GL_TEXTURE_2D,
WGL_ACCESS_READ_WRITE_NV);
03-30-2019 07:35 AM
04-07-2019 02:16 PM
04-13-2019 03:51 PM
04-13-2019 03:55 PM
04-15-2019 07:24 AM
04-15-2019 11:39 AM
04-15-2019 01:26 PM
04-15-2019 01:41 PM
04-15-2019 01:49 PM