diff --git a/.doctrees/1-introduction.doctree b/.doctrees/1-introduction.doctree index 476c68a6..ec3a359d 100644 Binary files a/.doctrees/1-introduction.doctree and b/.doctrees/1-introduction.doctree differ diff --git a/.doctrees/2-setup.doctree b/.doctrees/2-setup.doctree index 491ce3ae..2fba6f71 100644 Binary files a/.doctrees/2-setup.doctree and b/.doctrees/2-setup.doctree differ diff --git a/.doctrees/changelist.doctree b/.doctrees/changelist.doctree index 864d2300..07a54ab1 100644 Binary files a/.doctrees/changelist.doctree and b/.doctrees/changelist.doctree differ diff --git a/.doctrees/environment.pickle b/.doctrees/environment.pickle index 8e886ca1..021f2886 100644 Binary files a/.doctrees/environment.pickle and b/.doctrees/environment.pickle differ diff --git a/1-introduction.html b/1-introduction.html index f8120ab5..c6518457 100644 --- a/1-introduction.html +++ b/1-introduction.html @@ -1010,6 +1010,9 @@
Now, create a text file called main.cpp
in the Chapter2
folder. Open main.cpp
and add the following:
#include <DebugOutput.h>
+
Next, we add the GraphicsAPI_....h
header to include the GraphicsAPI
code of your chosen graphics API. This will in turn include GraphicsAPI.h
, HelperFunctions.h
and OpenXRHelper.h
.
#include <GraphicsAPI_D3D11.h>
@@ -1071,7 +1074,7 @@ 1.4.3 Main.cpp and the OpenXRTutorial ClassOpenXRTutorial_Main(), in which we create an instance of our OpenXRTutorial
class, taking a GraphicsAPI_Type
parameter, and call the Run()
method. GraphicsAPI_Type
can be changed to suit the graphics API that you have chosen.
void OpenXRTutorial_Main(GraphicsAPI_Type apiType) {
DebugOutput debugOutput; // This redirects std::cerr and std::cout to the IDE's output or Android Studio's logcat.
- LOG_INFO("OpenXR Tutorial Chapter 2");
+ XR_TUT_LOG("OpenXR Tutorial Chapter 2");
OpenXRTutorial app(apiType);
app.Run();
}
@@ -1283,14 +1286,14 @@ 1.4.4 Build and Run[...]/<workspaceFolder>/Chapter2 $ "../build/Chapter2/OpenXRTutorialChapter2"
-With all the source and build systems set up, we can now build the Android project. In upper right of Android Studio, you should find the toolbar below. Click the green hammer icon to build the project, if all is successful you should see “BUILD SUCCESSFUL in […]s” in the Build Output window.
-It is also recommended to sync the gradle files too.
+With all the source and build system files set up, we can now build our Android project. If while editing main.cpp
or any other file you are seeing warnings like this: "This file does not belong to any project target..."
, right-click on the top-level folder of the project in the Project
panel, select Mark Directory as >
, and click the option Sources Root
.
+To build your project go to the upper right of Android Studio, and there you should find the toolbar below. Click the green hammer icon to build the project, if all is successful you should see “BUILD SUCCESSFUL in […]s” in the Build Output window. It is also recommended to sync the gradle files too.
Next to the green hammer icon is the Run/Debug configuration dropdown menu. If that isn’t populated, create a configuration called app.
-Turn on and connect your Android device. Set up any requirements for USB debugging and adb. Your device should appear in the dropdown. Here, we are using a Meta Quest 2:
+Turn on and connect your Android device. Set up any requirements for USB debugging and adb
. Your device should appear in the dropdown. Here, we are using a Meta Quest 2:
-To debug/run the application click the green bug icon.
+To debug/run the application click the green bug icon (the plain green bug, not the one with an arrow on it).
diff --git a/2-setup.html b/2-setup.html
index bf4b8ef4..99506322 100644
--- a/2-setup.html
+++ b/2-setup.html
@@ -502,7 +502,7 @@ 2.1.1 The OpenXR Instance }
}
if (!found) {
- LOG_ERROR("Failed to find OpenXR instance extension: " << requestedInstanceExtension);
+ XR_TUT_LOG_ERROR("Failed to find OpenXR instance extension: " << requestedInstanceExtension);
}
}
@@ -533,7 +533,7 @@ 2.1.1 The OpenXR InstanceXrInstanceProperties instanceProperties{XR_TYPE_INSTANCE_PROPERTIES};
OPENXR_CHECK(xrGetInstanceProperties(m_xrInstance, &instanceProperties), "Failed to get InstanceProperties.");
-LOG_INFO("OpenXR Runtime: " << instanceProperties.runtimeName << " - "
+XR_TUT_LOG("OpenXR Runtime: " << instanceProperties.runtimeName << " - "
<< XR_VERSION_MAJOR(instanceProperties.runtimeVersion) << "."
<< XR_VERSION_MINOR(instanceProperties.runtimeVersion) << "."
<< XR_VERSION_PATCH(instanceProperties.runtimeVersion));
@@ -881,13 +881,13 @@ 2.3.1 xrPollEvent // Log the number of lost events from the runtime.
case XR_TYPE_EVENT_DATA_EVENTS_LOST: {
XrEventDataEventsLost *eventsLost = reinterpret_cast<XrEventDataEventsLost *>(&eventData);
- LOG_INFO("OPENXR: Events Lost: " << eventsLost->lostEventCount);
+ XR_TUT_LOG("OPENXR: Events Lost: " << eventsLost->lostEventCount);
break;
}
// Log that an instance loss is pending and shutdown the application.
case XR_TYPE_EVENT_DATA_INSTANCE_LOSS_PENDING: {
XrEventDataInstanceLossPending *instanceLossPending = reinterpret_cast<XrEventDataInstanceLossPending *>(&eventData);
- LOG_INFO("OPENXR: Instance Loss Pending at: " << instanceLossPending->lossTime);
+ XR_TUT_LOG("OPENXR: Instance Loss Pending at: " << instanceLossPending->lossTime);
m_sessionRunning = false;
m_applicationRunning = false;
break;
@@ -895,9 +895,9 @@ 2.3.1 xrPollEvent // Log that the interaction profile has changed.
case XR_TYPE_EVENT_DATA_INTERACTION_PROFILE_CHANGED: {
XrEventDataInteractionProfileChanged *interactionProfileChanged = reinterpret_cast<XrEventDataInteractionProfileChanged *>(&eventData);
- LOG_INFO("OPENXR: Interaction Profile changed for Session: " << interactionProfileChanged->session);
+ XR_TUT_LOG("OPENXR: Interaction Profile changed for Session: " << interactionProfileChanged->session);
if (interactionProfileChanged->session != m_session) {
- LOG_INFO("XrEventDataInteractionProfileChanged for unknown Session");
+ XR_TUT_LOG("XrEventDataInteractionProfileChanged for unknown Session");
break;
}
break;
@@ -905,9 +905,9 @@ 2.3.1 xrPollEvent // Log that there's a reference space change pending.
case XR_TYPE_EVENT_DATA_REFERENCE_SPACE_CHANGE_PENDING: {
XrEventDataReferenceSpaceChangePending *referenceSpaceChangePending = reinterpret_cast<XrEventDataReferenceSpaceChangePending *>(&eventData);
- LOG_INFO("OPENXR: Reference Space Change pending for Session: " << referenceSpaceChangePending->session);
+ XR_TUT_LOG("OPENXR: Reference Space Change pending for Session: " << referenceSpaceChangePending->session);
if (referenceSpaceChangePending->session != m_session) {
- LOG_INFO("XrEventDataReferenceSpaceChangePending for unknown Session");
+ XR_TUT_LOG("XrEventDataReferenceSpaceChangePending for unknown Session");
break;
}
break;
diff --git a/_downloads/a668d9f10e44c7f46a041356e11e3d9e/DebugOutput.h b/_downloads/a668d9f10e44c7f46a041356e11e3d9e/DebugOutput.h
index 35b116cb..1ae46efb 100644
--- a/_downloads/a668d9f10e44c7f46a041356e11e3d9e/DebugOutput.h
+++ b/_downloads/a668d9f10e44c7f46a041356e11e3d9e/DebugOutput.h
@@ -85,6 +85,7 @@ class DebugOutput : public vsBufferedStringStreamBuf {
std::streambuf *old_cout_buffer;
std::streambuf *old_cerr_buffer;
};
+
#elif defined(__linux__) && !defined(__ANDROID__)
#include
class DebugOutput {
@@ -105,7 +106,7 @@ class AndroidStreambuf : public std::streambuf {
bufsize = 128
}; // ... or some other suitable buffer size
android_LogPriority logPriority;
- AndroidStreambuf(android_LogPriority p = ANDROID_LOG_INFO) {
+ AndroidStreambuf(android_LogPriority p = ANDROID_LOG_DEBUG) {
logPriority = p;
this->setp(buffer, buffer + bufsize - 1);
}
@@ -169,4 +170,28 @@ class DebugOutput {
DebugOutput() {
}
};
+
+
#endif
+
+#ifdef __ANDROID__
+#include
+#include
+
+#define XR_TUT_LOG_TAG "openxr_tutorial"
+#define XR_TUT_LOG(...) { \
+ std::ostringstream ostr; \
+ ostr<<__VA_ARGS__; \
+ __android_log_write(ANDROID_LOG_DEBUG, XR_TUT_LOG_TAG, ostr.str().c_str()); \
+ }
+#define XR_TUT_LOG_ERROR(...) { \
+ std::ostringstream ostr; \
+ ostr<<__VA_ARGS__; \
+ __android_log_write(ANDROID_LOG_ERROR, XR_TUT_LOG_TAG, ostr.str().c_str()); \
+ }
+#else
+#include
+
+#define XR_TUT_LOG(...) std::cout << __VA_ARGS__ << "\n"
+#define XR_TUT_LOG_ERROR(...) std::cerr << __VA_ARGS__ << "\n"
+#endif
\ No newline at end of file
diff --git a/_downloads/c4b96771e22873e9c1d09d729dea1bd2/GraphicsAPI.cpp b/_downloads/c4b96771e22873e9c1d09d729dea1bd2/GraphicsAPI.cpp
index c6866e3d..88e709bd 100644
--- a/_downloads/c4b96771e22873e9c1d09d729dea1bd2/GraphicsAPI.cpp
+++ b/_downloads/c4b96771e22873e9c1d09d729dea1bd2/GraphicsAPI.cpp
@@ -19,6 +19,7 @@ bool CheckGraphicsAPI_TypeIsValidForPlatform(GraphicsAPI_Type type) {
const char *GetGraphicsAPIInstanceExtensionString(GraphicsAPI_Type type) {
#if defined(XR_USE_GRAPHICS_API_D3D11)
+ if (type == D3D11) {
return XR_KHR_D3D11_ENABLE_EXTENSION_NAME;
}
#endif
diff --git a/_images/android-studio-build-run-toolbar.png b/_images/android-studio-build-run-toolbar.png
index 22bf9a67..4b2d589d 100644
Binary files a/_images/android-studio-build-run-toolbar.png and b/_images/android-studio-build-run-toolbar.png differ
diff --git a/_sources/1-introduction.rst.txt b/_sources/1-introduction.rst.txt
index 01feb8d1..862a630d 100644
--- a/_sources/1-introduction.rst.txt
+++ b/_sources/1-introduction.rst.txt
@@ -926,17 +926,18 @@ Then, we create the actual platform-specific main function (our entry point to t
.. container:: android
- With all the source and build systems set up, we can now build the Android project. In upper right of Android Studio, you should find the toolbar below. Click the green hammer icon to build the project, if all is successful you should see "BUILD SUCCESSFUL in [...]s" in the Build Output window.
- It is also recommended to sync the gradle files too.
+ With all the source and build system files set up, we can now build our Android project. If while editing ``main.cpp`` or any other file you are seeing warnings like this: ``"This file does not belong to any project target..."``, right-click on the top-level folder of the project in the ``Project`` panel, select ``Mark Directory as >``, and click the option ``Sources Root``.
+
+ To build your project go to the upper right of Android Studio, and there you should find the toolbar below. Click the green hammer icon to build the project, if all is successful you should see "BUILD SUCCESSFUL in [...]s" in the Build Output window. It is also recommended to sync the gradle files too.
Next to the green hammer icon is the Run/Debug configuration dropdown menu. If that isn't populated, create a configuration called app.
- Turn on and connect your Android device. Set up any requirements for USB debugging and adb. Your device should appear in the dropdown. Here, we are using a Meta Quest 2:
+ Turn on and connect your Android device. Set up any requirements for USB debugging and ``adb``. Your device should appear in the dropdown. Here, we are using a Meta Quest 2:
.. figure:: images/android-studio-build-run-toolbar.png
:alt: Build/Run Toolbar
- To debug/run the application click the green bug icon.
+ To debug/run the application click the green bug icon (the plain green bug, not the one with an arrow on it).
***********
diff --git a/_sources/changelist.rst.txt b/_sources/changelist.rst.txt
index 783e2cf3..9b73cf35 100644
--- a/_sources/changelist.rst.txt
+++ b/_sources/changelist.rst.txt
@@ -2,6 +2,13 @@ Changelist
=========
.. code-block:: json
+ | **Wed 22 Nov** : More consistent Android Studio toolbar image. Better fix for "This file does not belong to any project target..." warning.
+ | **Wed 22 Nov** : Merge branch 'main' of github.com:simul/openxr-tutorial-src
+ | **Wed 22 Nov** : Using XR_TUT_LOG and XR_TUT_LOG_ERROR for logging - improves Android logging behaviour.
+ | **Wed 22 Nov** : Merge branch 'main' of github.com:simul/openxr-tutorial-src into main
+ | **Wed 22 Nov** : Updated Chapter 1 text to explain how to resolve Android Studio warning. #70
+ | **Wed 22 Nov** : Merge branch 'main' of github.com:simul/openxr-tutorial-src
+ | **Wed 22 Nov** : Added SVG's of spaces illustrations.
| **Wed 22 Nov** : Merge branch 'main' of github.com:KhronosGroup/OpenXR-Tutorials into main
| **Wed 22 Nov** : Fixed AndroidBuildFolder.zip folder structure. #84
| **Tue 21 Nov** : Merge pull request #56 from rpavlik/simplify-log
@@ -94,11 +101,4 @@ Changelist
| **Mon 30 Oct** : Fixed typo in Chapter 4 text. Removed repeated line in 1.2 text. Added text to describe CMake cmdline build and running the app from the cmdline.
| **Fri 27 Oct** : Fixed minor typos.
| **Fri 27 Oct** : Added Common_....zip download links. Common/xr_linear_algebra.h is not present in the zip.
- | **Fri 27 Oct** : Fixed build-common-archs.sh. Restored cmdline args too.
- | **Fri 27 Oct** : Updated build-common-archs.sh to not use cmdline parametes
- | **Fri 27 Oct** : Updated build-common-archs.sh
- | **Fri 27 Oct** : Added build scripts for creating archives of the Common folder.
- | **Fri 27 Oct** : Removed Android comment in CMakeLists.txt files.
- | **Fri 27 Oct** : Reflowed text and code in 2.1.2.
- | **Fri 27 Oct** : Reflowed CMAKE_MODULE_PATH code and text. Fixed code highlighting in 2.1 text. Chapter 3 text states that the XR compositor is part of the runtime.
- | **Fri 27 Oct** : Moved TODO outside of text snippet.
\ No newline at end of file
+ | **Fri 27 Oct** : Fixed build-common-archs.sh. Restored cmdline args too.
\ No newline at end of file
diff --git a/changelist.html b/changelist.html
index 74527e3b..dbcf8650 100644
--- a/changelist.html
+++ b/changelist.html
@@ -355,7 +355,14 @@
Changelist¶
-| **Wed 22 Nov** : Merge branch 'main' of github.com:KhronosGroup/OpenXR-Tutorials into main
+| **Wed 22 Nov** : More consistent Android Studio toolbar image. Better fix for "This file does not belong to any project target..." warning.
+| **Wed 22 Nov** : Merge branch 'main' of github.com:simul/openxr-tutorial-src
+| **Wed 22 Nov** : Using XR_TUT_LOG and XR_TUT_LOG_ERROR for logging - improves Android logging behaviour.
+| **Wed 22 Nov** : Merge branch 'main' of github.com:simul/openxr-tutorial-src into main
+| **Wed 22 Nov** : Updated Chapter 1 text to explain how to resolve Android Studio warning. #70
+| **Wed 22 Nov** : Merge branch 'main' of github.com:simul/openxr-tutorial-src
+| **Wed 22 Nov** : Added SVG's of spaces illustrations.
+| **Wed 22 Nov** : Merge branch 'main' of github.com:KhronosGroup/OpenXR-Tutorials into main
| **Wed 22 Nov** : Fixed AndroidBuildFolder.zip folder structure. #84
| **Tue 21 Nov** : Merge pull request #56 from rpavlik/simplify-log
| **Tue 21 Nov** : Merge branch 'main' into simplify-log
@@ -448,13 +455,6 @@ Changelist