Forum Discussion
RobbyKraft
12 years agoHonored Guest
native Oculus OSX Xcode build
I have spent a few weekends organizing my notes, here should be everything you need to build a skeleton Oculus Rift project in Xcode-
Start with a blank Cocoa app
Drag LibOVR into Xcode Project, uncheck all “Add to Target”

Linked Frameworks and Libraries:

Architectures

Apple LLVM 5.0 - Language - C++


Search Paths
------
Any classes which include OVR.h, and the classes which include THOSE classes, must be named *.mm, or must be marked as Objective-C++ source

------
for reference: here is this example’s folder location for how they reference the header/search paths

------
to check if everything got setup correctly, edit main.mm:
if it builds, everything should be working!
project source: https://github.com/robbykraft/SimpleOculus includes an OpenGL scene to test in the headset.
I'm running Xcode 5.0 and I'm able to build as far back as 10.6. Hope this works for everyone else too!
Start with a blank Cocoa app
Drag LibOVR into Xcode Project, uncheck all “Add to Target”

Linked Frameworks and Libraries:
- libovr.a (LibOVR/Lib/MacOS/Debug)
- IOKit.framework

Architectures
- Architectures : 64-bit Intel (x86_64)

Apple LLVM 5.0 - Language - C++
- C++ Standard Library : libstdc++ (GNU C++ standard library)
- Enable C++ Exceptions : No
- Enable C++ Runtime Types : No


Search Paths
- Header Search Paths : LibOVR/Src, LibOVR/Include
- Library Search Paths :
- - Debug : LibOVR/Lib/MacOS/Debug
- - Release : LibOVR/Lib/MacOS/Release
------
Any classes which include OVR.h, and the classes which include THOSE classes, must be named *.mm, or must be marked as Objective-C++ source

------
for reference: here is this example’s folder location for how they reference the header/search paths

------
to check if everything got setup correctly, edit main.mm:
#import <Cocoa/Cocoa.h>
#include "OVR.h”
using namespace OVR;
int main(int argc, const char * argv[])
{
System::Init();
return NSApplicationMain(argc, argv);
}
if it builds, everything should be working!
project source: https://github.com/robbykraft/SimpleOculus includes an OpenGL scene to test in the headset.
I'm running Xcode 5.0 and I'm able to build as far back as 10.6. Hope this works for everyone else too!
2 Replies
- r03ert0Honored Guesthello,
thank you for SimpleOculus! it was just what i needed to start going with OVR and cocoa.
One question. I tried to add a cube to the panorama, but the interpupillary distance was awkward... what is the appropriate way of adding objects? This is what I added to Scene.mm, to try to display a cube:
void Scene::render() {
drawPanorama();
int i,j;
GLfloat o[3]={0,0,-5};
GLfloat P[]={ 0,0,0, 1,0,0, 1,1,0, 0,1,0,
0,0,1, 1,0,1, 1,1,1, 0,1,1};
GLfloat C[]={ 0,0,0, 1,0,0, 1,1,0, 0,1,0,
0,0,1, 1,0,1, 1,1,1, 0,1,1};
GLint T[]={ 0,1,2, 0,2,3,
1,5,6, 1,6,2,
5,4,7, 5,7,6,
4,0,3, 4,3,7,
3,2,6, 3,6,7,
0,4,1, 1,4,5};
for(i=0;i<8*3;i++)
P[i]=(P[i]-0.5)*1;
glBegin(GL_TRIANGLES);
for(i=0;i<12;i++)
for(j=0;j<3;j++) {
glColor4f(C[T[3*i+j]*3+0],C[T[3*i+j]*3+1],C[T[3*i+j]*3+2],1);
glVertex3f(o[0]+P[T[3*i+j]*3+0],o[1]+P[T[3*i+j]*3+1],o[2]+P[T[3*i+j]*3+2]);
}
glEnd();
}
Also... the cube renders all squished...
thank you in advance for your help!
roberto - melterryHonored GuestI get this error...
OVR_SensorImpl.d
DTrace error
expected predicate and/or actions following probe description
thoughts?
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device