Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
So, Ive managed to make some progress with c++ and have already made a custom binary using openxr sdk and openxr_loader.lib and tried to make a .cpp as a main to fuction the xrSession using the COculusRiftSupport.cpp and .h as reference. Managed to build it but still having an issue because when i publish my game with it, it will publish but force closes when it try's to play. when i take it out of the directory and play it, it doesnt force close but will show error that openxr_loader.dll wasnt found because it need to stay in the directory obviously. but that shows that it does integrate it but maybe im just doing something wrong with my program before building it. Anyone willing to help with some experience would be appreciated, thanks. |
||||
|
This is one of the binaries im working on main.cpp [code]include "C:\Users\EBENEZER\Desktop\CCModXR\CCModXR\CCModXR\COculusRiftSupport-0.3.h" include <CFlaceAnimatorCameraFPS.h> include <CCameraSceneNode.h> ifdef MAIN_INITIALIZED ifdef WIN32 ifdef _DEBUG pragma comment(lib, "openxr_loaderd.lib") // Debug version of the OpenXR loader else pragma comment(lib, "openxr_loader.lib") // Release version of the OpenXR loader endif endif include <Windows.h> include <iostream> // For error reporting and debugging using namespace irr; CQuest3Support::CQuest3Support() : xrInstance(0), xrSystemId(XR_NULL_SYSTEM_ID), xrSession(0), xrHeadSpace(0), DistortionMeshCreated(false), QuestDeviceAvailable(false), DeviceIsFakedOnly(false), UserWantedToQuit(false), UseDistortion(true), CurrentlyRenderingLeftEye(false), WorldUnitScale(1.0f), InitInterpupillaryDistance(0.0f), RenderTargetTexture(0), HandleLastCameraUsed(0), Width(1280), Height(720) { RenderTargetSize[0] = 1280; RenderTargetSize[1] = 720; EyePos = irr::core::vector3df(0.0f, 0.0f, 0.0f); EyeYaw = 0.0f; EyePitch = 0.0f; EyeRoll = 0.0f; } CQuest3Support::~CQuest3Support() { if (RenderTargetTexture) { RenderTargetTexture->drop(); } if (xrSession != XR_NULL_HANDLE) { xrDestroySession(xrSession); } if (xrInstance != XR_NULL_HANDLE) { xrDestroyInstance(xrInstance); } } void CQuest3Support::globalQuest3Init() { std::cout << "Global initialization for Quest 3 completed." << std::endl; } bool CQuest3Support::initBeforeWindowCreation() { XrInstanceCreateInfo instanceCreateInfo = { XR_TYPE_INSTANCE_CREATE_INFO }; strcpy(instanceCreateInfo.applicationInfo.applicationName, "Quest3App"); instanceCreateInfo.applicationInfo.apiVersion = XR_CURRENT_API_VERSION; XrResult result = xrCreateInstance(&instanceCreateInfo, &xrInstance); if (XR_FAILED(result)) { std::cerr << "Failed to create OpenXR instance: " << result << std::endl; UserWantedToQuit = true; return false; } XrSystemGetInfo systemInfo = { XR_TYPE_SYSTEM_GET_INFO }; systemInfo.formFactor = XR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY; result = xrGetSystem(xrInstance, &systemInfo, &xrSystemId); if (XR_FAILED(result)) { std::cerr << "Failed to get OpenXR system: " << result << std::endl; UserWantedToQuit = true; return false; } QuestDeviceAvailable = xrSystemId != XR_NULL_SYSTEM_ID; return QuestDeviceAvailable; } bool CQuest3Support::userWantedToQuit() { return UserWantedToQuit; } void CQuest3Support::adjustIrrlichtCreationParameters(SIrrlichtCreationParameters& params) { if (QuestDeviceAvailable) { params.DriverType = video::EDT_OPENGL; params.WindowSize = core::dimension2d<u32>(Width, Height); params.Fullscreen = true; } } bool CQuest3Support::onAfterDeviceCreated(IrrlichtDevice* device) { Device = device; if (!device || !QuestDeviceAvailable) { return false; } video::IVideoDriver* driver = device->getVideoDriver(); if (driver->queryFeature(video::EVDF_RENDER_TO_TARGET)) { RenderTargetTexture = driver->addRenderTargetTexture( core::dimension2d<s32>(RenderTargetSize[0], RenderTargetSize[1])); if (!RenderTargetTexture) { std::cerr << "Failed to create render target texture." << std::endl; return false; } } else { std::cerr << "Render to target not supported." << std::endl; return false; } createDistortionMesh(); return true; } irr::core::vector3df CQuest3Support::getIrrVector(const XrVector3f& xrVector) { return irr::co |
||||
|
[code]include "C:\Users\EBENEZER\Desktop\CCModXR\CCModXR\CCModXR\COculusRiftSupport-0.3.h" include <CFlaceAnimatorCameraFPS.h> include <CCameraSceneNode.h> ifdef MAIN_INITIALIZED ifdef WIN32 ifdef _DEBUG pragma comment(lib, "openxr_loaderd.lib") // Debug version of the OpenXR loader else pragma comment(lib, "openxr_loader.lib") // Release version of the OpenXR loader endif endif include <Windows.h> include <iostream> // For error reporting and debugging using namespace irr; CQuest3Support::CQuest3Support() : xrInstance(0), xrSystemId(XR_NULL_SYSTEM_ID), xrSession(0), xrHeadSpace(0), DistortionMeshCreated(false), QuestDeviceAvailable(false), DeviceIsFakedOnly(false), UserWantedToQuit(false), UseDistortion(true), CurrentlyRenderingLeftEye(false), WorldUnitScale(1.0f), InitInterpupillaryDistance(0.0f), RenderTargetTexture(0), HandleLastCameraUsed(0), Width(1280), Height(720) { RenderTargetSize[0] = 1280; RenderTargetSize[1] = 720; EyePos = irr::core::vector3df(0.0f, 0.0f, 0.0f); EyeYaw = 0.0f; EyePitch = 0.0f; EyeRoll = 0.0f; } CQuest3Support::~CQuest3Support() { if (RenderTargetTexture) { RenderTargetTexture->drop(); } if (xrSession != XR_NULL_HANDLE) { xrDestroySession(xrSession); } if (xrInstance != XR_NULL_HANDLE) { xrDestroyInstance(xrInstance); } } void CQuest3Support::globalQuest3Init() { std::cout << "Global initialization for Quest 3 completed." << std::endl; } bool CQuest3Support::initBeforeWindowCreation() { XrInstanceCreateInfo instanceCreateInfo = { XR_TYPE_INSTANCE_CREATE_INFO }; strcpy(instanceCreateInfo.applicationInfo.applicationName, "Quest3App"); instanceCreateInfo.applicationInfo.apiVersion = XR_CURRENT_API_VERSION; XrResult result = xrCreateInstance(&instanceCreateInfo, &xrInstance); if (XR_FAILED(result)) { std::cerr << "Failed to create OpenXR instance: " << result << std::endl; UserWantedToQuit = true; return false; } XrSystemGetInfo systemInfo = { XR_TYPE_SYSTEM_GET_INFO }; systemInfo.formFactor = XR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY; result = xrGetSystem(xrInstance, &systemInfo, &xrSystemId); if (XR_FAILED(result)) { std::cerr << "Failed to get OpenXR system: " << result << std::endl; UserWantedToQuit = true; return false; } QuestDeviceAvailable = xrSystemId != XR_NULL_SYSTEM_ID; return QuestDeviceAvailable; } bool CQuest3Support::userWantedToQuit() { return UserWantedToQuit; } void CQuest3Support::adjustIrrlichtCreationParameters(SIrrlichtCreationParameters& params) { if (QuestDeviceAvailable) { params.DriverType = video::EDT_OPENGL; params.WindowSize = core::dimension2d<u32>(Width, Height); params.Fullscreen = true; } } bool CQuest3Support::onAfterDeviceCreated(IrrlichtDevice* device) { Device = device; if (!device || !QuestDeviceAvailable) { return false; } video::IVideoDriver* driver = device->getVideoDriver(); if (driver->queryFeature(video::EVDF_RENDER_TO_TARGET)) { RenderTargetTexture = driver->addRenderTargetTexture( core::dimension2d<s32>(RenderTargetSize[0], RenderTargetSize[1])); if (!RenderTargetTexture) { std::cerr << "Failed to create render target texture." << std::endl; return false; } } else { std::cerr << "Render to target not supported." << std::endl; return false; } createDistortionMesh(); return true; } irr::core::vector3df CQuest3Support::getIrrVector(const XrVector3f& xrVector) { return irr::core::vector3df(xrVector.x, xrVector.y, xrVector.z); } void CQuest3Supp |
||||
|
Sorry maybe to long for the source codeto work |
||||
|
Never tried such stuff before. You would obviously be using a high quality code editor like Visual Studio Code/Community to debug stuff ? They seem to have a lot of new features to help diagnose code issues. |
||||
|
define MAIN_INITIALIZED |
||||
|
This is acually the main the other was another file that goes with it |
||||
|
@ArchAngel Are you actually trying something to get CopperCube projects to run as vr games on meta quest 3? If so, that would be great news. |
||||
|
Yes, that’s what I’m currently working towards. I’m approaching it at a few different angles and hopefully one of them will work. I have the studio edition so I’m working on a custom binary for those who can use them and for those who can’t I’m creating a c++ server and coppercube side scripts to interact with the server for updates on frames/ headset position/ and motion controller support. May still be a little before I get one running with everything included but stay posted. |
||||
|
Also even though it will work on the Quest, it will still be PCVR. So you would need to be connected to pc either via WiFi or link cable. |
||||
|
At least until I create an android version. |
||||
|
So current state of OpenXrServer.exe- I have been able to get the server to load into OpenXR and attempt to submit the frames for the view to start showing in the headset. But currently failing to load the texture to start viewing, I should have that fixed today! Then incorporating headset tracking and updating, then motion controller tracking as well. Currently working on two different versions, one to not be published with your coppercube game and one to be published with your coppercube game. For the second of the two I’m only having an issue because when published with the ccb game, coppercube runs the custom binary first, which makes it fail because the open r server need the game running first so that it can pull the current OpenGL framebuffer to start, so currently troubleshooting through both. Will give another update when more is completed. |
|