Skip to content

Commit 4a67b9d

Browse files
committed
#[Changes] Links, titles, categories
- Added links to various sites - Setup the titles properly (for real this time) - Changed categories again
1 parent 5f2b2a0 commit 4a67b9d

File tree

4 files changed

+108
-16
lines changed

4 files changed

+108
-16
lines changed

.obsidian/workspace.json

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,23 @@
164164
},
165165
"active": "685d872682c8fed7",
166166
"lastOpenFiles": [
167+
"_site/categories/virtual-reality/index.html",
168+
"_site/categories/virtual-reality",
169+
"_site/categories/virtual-reailty/index.html",
170+
"_site/categories/virtual-reailty",
171+
"_site/posts/OpenXrCustomEngine/index.html",
172+
"_site/posts/OpenXrCustomEngine",
173+
"_site/categories/vr/index.html",
174+
"_site/categories/vr",
175+
"_site/categories/programming/index.html",
176+
"_site/categories/programming",
177+
"_site/tags/entt/index.html",
178+
"_site/assets/lib/fontawesome-free/README.md",
179+
"_site/assets/lib/README.md",
180+
"_site/assets/Justin.jpg",
167181
"_posts/2025-01-20-OpenXrCustomEngine.md",
168182
"assets/Justin.jpg",
169183
"_tabs/about.md",
170-
"assets/__rar_38744.39111",
171-
"assets/__rar_38744.38383",
172-
"assets/__rar_4040.20744",
173-
"assets/__rar_4040.18916",
174-
"assets/vrmanager.rar",
175184
"_tabs/tags.md",
176185
"_tabs/categories.md",
177186
"_tabs/archives.md",

_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ social:
4242
- https://github.com/cyndeon # change to your GitHub homepage
4343
# Uncomment below to add more social links
4444
# - https://www.facebook.com/username
45-
# - https://www.linkedin.com/in/username
45+
- https://www.linkedin.com/in/justin-comans/
4646

4747
# Site Verification Settings
4848
webmaster_verifications:

_data/contact.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
- type: email
1010
icon: "fas fa-envelope"
11-
noblank: true # open link in current tab
11+
noblank: false # open link in current tab
1212

1313
#- type: rss
1414
# icon: "fas fa-rss"
@@ -22,6 +22,22 @@
2222
- type: linkedin
2323
icon: 'fab fa-linkedin' # icons powered by <https://fontawesome.com/>
2424
url: 'https://www.linkedin.com/in/justin-comans-8494971b8' # Fill with your Linkedin homepage
25+
26+
- type: itch
27+
icon: 'fab fa-itch-io' # icons powered by <https://fontawesome.com/>
28+
url: 'https://cyndeon.itch.io/' # Fill with your Itch homepage
29+
30+
- type: gamejolt
31+
icon: 'fa-solid fa-bolt' # icons powered by <https://fontawesome.com/>
32+
url: 'https://gamejolt.com/@SuperJustin' # Fill with your Gamejolt homepage
33+
34+
- type: notion
35+
icon: 'fa-solid fa-n' # icons powered by <https://fontawesome.com/>
36+
url: 'https://www.notion.so/Justin-C-cbe31a1b387d451fb2407c32e0a377e8' # Fill with your Notion homepage
37+
38+
- type: linktree
39+
icon: 'fa-solid fa-tree' # icons powered by <https://fontawesome.com/>
40+
url: 'https://linktr.ee/JustinGameDev' # Fill with your Linktree homepage
2541
#
2642
# - type: stack-overflow
2743
# icon: 'fab fa-stack-overflow'

_posts/2025-01-20-OpenXrCustomEngine.md

Lines changed: 76 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,18 @@
22
title: How I implemented OpenXR rendering into a custom engine in C++
33
date: 2025-01-20 18:33:00 +/-0100
44
categories:
5-
- Vr
6-
- Gamedev
5+
- Programming
6+
- Virtual-Reality
77
tags:
88
- cpp
99
- openxr
1010
- opengl
11-
- programming
1211
- entt
1312
description: A blog about how to implement OpenXR rendering into a custom C++ engine.
1413
toc: true
1514
---
1615
# This blog post is unfinished and still a work in progress!
17-
#### Intro
16+
## Intro
1817

1918
I am Justin, a second year student at BUAS and for the past 7 weeks, I have been working on implementing OpenXR into a custom engine made by the lecturers here called "Bee".
2019
During the process of implementing OpenXR I have learned a lot about not only OpenXR, but also OpenGL, which is the rendering library that Bee uses. Of course, none of this hasn't been without running into many obstacles. In this blog post I will explain how I implemented OpenXR and combined it with the pre-existing Bee library. I will go over what my original plans were, how I got the required scripts to run, how I made the rendering using the OpenXR swapchains combined with OpenGL and much more!
@@ -24,12 +23,12 @@ It is worth keeping in mind that I used my Rift S to test any code that I wrote.
2423
For those wishing to skip straight to the end and/or take a look at my code, I below will be the entire class. Do keep in mind that there are some variables and functions for OpenXR's input that do not work as of writing this! The files are unfiltered and will likely contain things your project might not.
2524
[VrManager](https://github.com/Cyndeon/cyndeon.github.io/blob/main/assets/vrmanager.rar)
2625

27-
#### Requirements
26+
## Requirements
2827
- Visual Studio (or another environment for programming)
29-
- VR headset compatible with OpenXR (I used a Rift S for this)
30-
- An engine in C++ (At the very least, it should be able to open a window and render graphics to a framebuffer, with a rendering function that we can call manually in our script. The framebuffer will also have to be accessible. It also will need to use Entt or you will have to modify the code to remove the Entt parts)
28+
- VR headset compatible with OpenXR
29+
- An engine in C++ (At the very least, it should be able to open a window and render graphics to a framebuffer, with a rendering function that we can call manually in our script. The framebuffer will also have to be accessible and the size needs to be able to be set before creation)
3130

32-
#### First steps
31+
## First steps
3332

3433
So the first step to any project, deciding on what you want to make and setting up some milestones for yourself. These don't always have to be time-bound, but in my case, since this is for school, I have 1 milestone every 2 weeks excluding the first week, so week 3, 5 and 7 all had milestones attached to them.
3534
For me, the end result was that I wanted to be able to render a scene to my VR headset and be able to move around some physics objects with my hands. I also wanted to add some basic movement, which at the time I hadn't exactly decided on yet, but I did know that simple walking around when moving the thumbstick would be the easiest and thus most likely to be implemented. For being able to use physics, I was going to use the Jolt library, which is a library can deal with the physics calculations.
@@ -58,7 +57,7 @@ Week 7 milestone: Implement controller input and then implement Jolt physics for
5857
As one might be able to tell, I got stuck on the rendering part for a good while before finally getting it to work properly and I will go into more detail when we get to the rendering step.
5958
As one can also see, the milestones had changed a lot since when I first started compared to when the project was over. Plans change, stuff like this happens, mostly when researching subjects that one does not have any knowledge of. New things will most likely take a lot of time to do properly and thus, the milestones should evolve over time to better and more accurately reflect one's progress.
6059

61-
#### Implementing OpenXR
60+
## Implementing OpenXR
6261
So, the goals have been set, now to implement the library and get to work!
6362
Personally, I downloaded the NuGet package with all the libraries. The package is called "OpenXR.Headers" by Khronos Group. I used version 1.0.10.2. Installing this package should also download OpenXR.Loader automatically.
6463

@@ -93,6 +92,8 @@ Now onto the actual interesting subjects.
9392

9493
The header will be explained first.
9594

95+
### Includes
96+
9697
First the includes. In my header I include the following:
9798
```cpp
9899
#pragma once
@@ -118,6 +119,8 @@ First the includes. In my header I include the following:
118119

119120
As shown here, I include some basic C++ things like strings and vectors, but also OpenXR and some Glad for math, you are free to use whatever math library you'd like, though you might have to create your own conversion functions to accommodate for this.
120121

122+
### Variables
123+
121124
After that, we will need a couple of variables, so it should look something like this:
122125
```cpp
123126
struct Dimensions
@@ -231,3 +234,67 @@ private:
231234
}
232235
```
233236
Now we've got some functions to properly set up and use the variables we just created. What these functions do is relatively self-explanatory based on the names of the variables, but we'll get to that soon enough.
237+
238+
### Creating the functions
239+
I will start from the top and work my way through each function, one at a time.
240+
First, the constructor, it's very short and simple. I call the Initialize() function that will set up everything for OpenXR, after that I create the pointer to my renderer but I also give the renderer the dimensions of my swapchain, this is because the framebuffer that the renderer creates should have the same size as the swapchainImages, since those are the ones that will be displayed to the user. I also use the first element in the array which is the left eye, it does not matter whether element 0 or 1 is used since both will have the same dimensions.
241+
```cpp
242+
VrManager::VrManager()
243+
{
244+
Initialize();
245+
m_renderer = &Engine.CreateRenderer(m_swapchainDimensions[0].width, m_swapchainDimensions[0].height);
246+
}
247+
```
248+
249+
Since the Initialize() function is rather big, I will go through it step by step to make it more digestible.
250+
251+
```cpp
252+
bool result = CreateInstance();
253+
if (!result)
254+
{
255+
std::cerr << "Instance creation failed" << std::endl;
256+
return false;
257+
}
258+
259+
result = GetSystem();
260+
if (!result)
261+
{
262+
std::cerr << "System detection failed" << std::endl;
263+
return false;
264+
}
265+
```
266+
First, the essentials. We create the instance and get the system details, as you can see here, I also have a boolean for result, if at any point, result returns false, something went wrong, we log it, and quit the setup. If your program would require some specific actions to happen if this setup fails, you can modify the constructor to do something if Initialize() returns false.
267+
268+
```cpp
269+
GetViewConfigurationViews();
270+
271+
XrSystemProperties systemProperties = {XR_TYPE_SYSTEM_PROPERTIES};
272+
result = xrGetSystemProperties(m_instance, m_systemId, &systemProperties);
273+
if (result != XR_SUCCESS)
274+
{
275+
std::cerr << "System Properties Not Found" << std::endl;
276+
}
277+
else
278+
{
279+
XrSystemGraphicsProperties graphicsProperties = systemProperties.graphicsProperties;
280+
std::cout << "Max swapchain width: " << graphicsProperties.maxSwapchainImageWidth << '\n';
281+
std::cout << "Max swapchain height: " << graphicsProperties.maxSwapchainImageHeight << '\n';
282+
}
283+
284+
XrGraphicsRequirementsOpenGLKHR graphicsRequirements = {XR_TYPE_GRAPHICS_REQUIREMENTS_OPENGL_KHR};
285+
PFN_xrGetOpenGLGraphicsRequirementsKHR pfnGetOpenGLGraphicsRequirementsKHR = NULL;
286+
result = xrGetInstanceProcAddr(m_instance,
287+
"xrGetOpenGLGraphicsRequirementsKHR",
288+
(PFN_xrVoidFunction*)&pfnGetOpenGLGraphicsRequirementsKHR);
289+
290+
if (result == XR_SUCCESS && pfnGetOpenGLGraphicsRequirementsKHR)
291+
{
292+
result = pfnGetOpenGLGraphicsRequirementsKHR(m_instance, m_systemId, &graphicsRequirements);
293+
294+
if (result != XR_SUCCESS)
295+
{
296+
std::cerr << "Failed to get OpenGL graphics requirements" << '\n';
297+
}
298+
}
299+
```
300+
Here we set up the configuration views and we also make sure

0 commit comments

Comments
 (0)