oculus1

view src/vr.h @ 29:9a973ef0e2a3

fixed the performance issue under MacOSX by replacing glutSolidTeapot (which uses glEvalMesh) with my own teapot generator.
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 27 Oct 2013 06:31:18 +0200
parents f3672317e5c2
children
line source
1 #ifndef VR_H_
2 #define VR_H_
4 /* VR mode init options */
5 enum vr_init_mode {
6 VR_INIT_NONE,
7 VR_INIT_OCULUS,
8 VR_INIT_STEREO
9 };
11 /* possible eye values */
12 enum {
13 VR_EYE_CENTER,
14 VR_EYE_LEFT,
15 VR_EYE_RIGHT
16 };
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
22 int vr_init(enum vr_init_mode mode);
23 void vr_shutdown(void);
25 const char *vr_get_display_name(void);
26 void vr_get_display_pos(int *xptr, int *yptr);
28 int vr_get_width(void);
29 int vr_get_height(void);
31 float vr_get_fov(void);
32 float vr_get_aspect(void);
34 void vr_set_eyedist(float ipd);
35 float vr_get_eyedist(void);
37 /* expects an array of 4 barrel distortion coefficients:
38 * polar scale: k_0 + k_1 r^2 + k_2 r^4 + k_3 r^6
39 */
40 void vr_set_distort(const float *coef);
41 void vr_get_distort(float *coef);
43 void vr_set_prediction_sec(float dt);
44 float vr_get_prediction_sec(void);
46 void vr_get_view_matrix(float *res, int eye);
47 void vr_get_proj_matrix(float *res, int eye);
49 /* expects an array of at least 3 floats (x, y, z, offset). */
50 void vr_get_translation(float *offs);
51 /* expects an array of at least 4 floats (x, y, z, w, quaternion). */
52 void vr_get_rotation(float *quat);
53 /* expects an array of at least 3 floats (pitch, yaw, roll, angles). */
54 void vr_get_rotation_euler(float *euler);
56 /* OpenGL stuff */
57 void vr_draw_eye(int eye, unsigned int tex, float tex_scale_x, float tex_scale_y);
59 #ifdef __cplusplus
60 }
61 #endif
63 #endif /* VR_H_ */