Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Lirezh's avatar
Lirezh
Explorer
10 years ago

No small C++ DX11 examples found, anything small available ?

I've been searching the net for hours, there is almost nothing at all for Oculus SDK and C++.
A few opengl examples and the two examples from Oculus.
The Tinyroom one is not really a small example, it's a 3D game engine with masses of complex structures.
It became more and more difficult to get the relevant stuff out.

The SDK documentation is not great either, until mid it shows Direct X and OpenGL in their examples and suddenly when the relevant parts really start all DirectX code is missing (starting with page 33).

I just want to render a "stationary" triangle and display it in stereo to the DK2 using non SDK rendering and Direct X 11 code.
I'd even be fine without distortion correction as a starter.

I've a triangle rendered using draw(), I got the HMD initialized but I am a bit lost with the stereo rendering/projection

Is there anything more basic than the quite large tinyroom code ?

10 Replies

  • Update:
    I'd actually be glad for any Oculus enabled DX11 c++ source code.
    If anyone has any old test projects demos around ..
    Would be great to get them shared!
  • I've created a small example of D3D OpenGL interoperability here: https://github.com/OculusRiftInAction/O ... nterop.cpp

    The skeleton is basically a D3D skeleton, while the rendering itself is done with OpenGL. However, you should be able to dump the OpenGL stuff and replace it with whatever D3D rendering you'd want to do.
  • I have seen your examples yesterday, they are exactly what I would have expected from Oculus.
    Small code covering one feature/task and not a thousand at once.

    Sadly I need it in DX11 and as a "beginner" in DX development it's difficult to get it converted.
    Also I'd need application rendering instead of SDK rendering.
    SDK rendering is not possible for what I am working on.

    The C++ example from Oculus is horrible:(
    You need counteless pages of code, classes, structures.
    I don't see why I need a dozend huge (many pages long) classes to define a shader or a simple 3d object.
    That's fine for a game engine but not for a SDK code example..
    I don't know what they were thinking ;/

    Still stuck, good 20 hours of time (18 of them wasted)

    I'm not far to post a paid job somewhere, however I think that for a pure developer product it should be possible without that.
  • Thanks Cyberreality
    That will probably come too late for me but sounds like a great steap ahead for new developers if you can get that done ;)

    I did not want to downplay the work done on the TinyRoomDemo, it's clearly done by a talented developer but it's not a SDK example.


    In my opinion the best help would be a set of minimal code examples:
    A single CPP file with a minimal header that shows off one feature
    Like one example that just renders a static cube using nothing but DirectX native buffers (no abstraction classes).
    One example with SDK rendering and a second one with application rendering (forget about defines, make it a new one).
    It can be done in 2-3 pages of code.

    If there is an advanced feature to show off, like time warp or repositioning, add it in another slightly larger example.


    Having such a demo would have saved me 2 whole days (and I bet it will be quite some more until I am done) of searching and debugging, trying around.
    I might not represent the majority of the developers here as my DX11 knowledge is minimal but I am usually quite fast in adapting when I have working example code.

    I also have searched countless hours about everything Google,Stackoverflow,Github,Koders can locate and I found nearly nothing in C++ and DirectX with Oculus support.
    That means something.


    P.S.
    If your team should have any other smaller C++ examples in a dusty corner, I'd not mind reading through ;)
  • lamour42's avatar
    lamour42
    Expert Protege
    Hi,

    I agree that the SDK samples are not very easy to follow and should be made clearer, which I already pointed out in other threads.

    But what I think you are missing is the complexity of a 'bare minimum' DirectX-Rift example. In DX11 there is absolutely no rendering without shader code. You need code to compile or load shader code, and set their input parameters. To see something useful on the rift you need texture handling, a camera system, keyboard and rift input handling and a lot of glue code. I thought about dumping down my Engine to the minimum and provide it to you, but it would be in the area of some thousands lines of code in at least a handful of classes. Plus at least 2 days work. All that for something that will not get you far anyway.

    Probably better would be to start with DirectX tutorials or books (without using Rift) and then try to build on that and put in the rift support you need.
  • "cybereality" wrote:
    I will speak with the team about simplifying the demos.


    The code quality for the TinyRoom could use improvement as well. I understand it's intended to be simple but I don't think that justifies the numerous memory leaks - very few of the allocations are cleaned up on exit. Even with the leaks I still think it's more verbose than it needs to be. I've got a somewhat cleaned up / simplified version that I could post but I'm not clear if the license allows for that?
  • I've started working on a simple Direct3D example, but I'm rapidly remembering why I hate Direct3D so much (I'll give you a hint... it rhymes with 'component object model'). I'm now looking at taking a pre-existing simple D3D app and porting it, rather than trying to untangle the tiny room app or port over my existing D3D interop or self-contained OpenGL examples.
  • I've managed to take one of the existing Microsoft Direct3D tutorials and port it to use the Rift within a single file...

    Here is the original file which simply renders to a window conventionally.

    Here is the file converted to use the Rift.

    More valuable, here are all the changes required to get from one to the other.
  • I did a bit more cleanup and stripping down of the D3D11 TinyRoom sample. The minimal, single file version is on github here. This cut down version only supports SDK rendering and Direct to Rift mode.