OVRRenderContext.h
Go to the documentation of this file.
1 //==============================================================================
2 /*
3  Software License Agreement (BSD License)
4  Copyright (c) 2003-2016, CHAI3D.
5  (www.chai3d.org)
6 
7  All rights reserved.
8 
9  Redistribution and use in source and binary forms, with or without
10  modification, are permitted provided that the following conditions
11  are met:
12 
13  * Redistributions of source code must retain the above copyright
14  notice, this list of conditions and the following disclaimer.
15 
16  * Redistributions in binary form must reproduce the above
17  copyright notice, this list of conditions and the following
18  disclaimer in the documentation and/or other materials provided
19  with the distribution.
20 
21  * Neither the name of CHAI3D nor the names of its contributors may
22  be used to endorse or promote products derived from this software
23  without specific prior written permission.
24 
25  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  POSSIBILITY OF SUCH DAMAGE.
37 
38  \author <http://www.chai3d.org>
39  \author Krzysztof Kondrak
40  \author Francois Conti
41  \version 3.1.1 $Rev: 1639 $
42 */
43 //==============================================================================
44 
45 //------------------------------------------------------------------------------
46 #ifndef OVRRenderContextH
47 #define OVRRenderContextH
48 //------------------------------------------------------------------------------
49 #include "math/CMaths.h"
50 #include <SDL.h>
51 #include <SDL_syswm.h>
52 //------------------------------------------------------------------------------
53 
54 //------------------------------------------------------------------------------
55 namespace chai3d {
56 //------------------------------------------------------------------------------
57 
58 //==============================================================================
66 //==============================================================================
67 
68 //==============================================================================
78 //==============================================================================
80 {
81  //--------------------------------------------------------------------------
82  // CONSTRUCTOR & DESTRUCTOR:
83  //--------------------------------------------------------------------------
84 
85 public:
86 
89  m_fov(chai3d::cDegToRad(75.0)),
90  m_nearPlane(0.1f),
91  m_farPlane(1000.f),
92  m_scrRatio(0.0f),
93  m_width(0),
94  m_height(0),
95  m_halfWidth(0),
96  m_halfHeight(0),
97  m_left(0.0f),
98  m_right(0.0f),
99  m_bottom(0.0f),
100  m_top(0.0f)
101  {
102  }
103 
106 
107 
108  //--------------------------------------------------------------------------
109  // PUBLIC METHODS:
110  //--------------------------------------------------------------------------
111 
112 public:
113 
114  void init(const char *title, int x, int y, int w, int h);
115  void destroy();
116 
117 
118  //--------------------------------------------------------------------------
119  // PUBLIC MEMBERS:
120  //--------------------------------------------------------------------------
121 
122 public:
123 
124  SDL_Window *window;
125  SDL_GLContext context;
126 
127  float m_fov;
128  float m_nearPlane;
129  float m_farPlane;
130  float m_scrRatio;
131  int m_width;
132  int m_height;
135 
136  // ortho parameters
137  float m_left;
138  float m_right;
139  float m_bottom;
140  float m_top;
141 
142  cTransform m_modelViewProjectionMatrix; // global MVP used to orient the entire world
143 };
144 
145 //------------------------------------------------------------------------------
146 } // namespace chai3d
147 //------------------------------------------------------------------------------
148 
149 //------------------------------------------------------------------------------
150 #endif
151 //------------------------------------------------------------------------------
SDL_Window * window
Definition: OVRRenderContext.h:124
float m_nearPlane
Definition: OVRRenderContext.h:128
void destroy()
Definition: OVRRenderContext.cpp:90
float m_bottom
Definition: OVRRenderContext.h:139
float m_scrRatio
Definition: OVRRenderContext.h:130
int m_halfWidth
Definition: OVRRenderContext.h:133
double cDegToRad(const double &a_angleDeg)
cOVRRenderContext()
Constructor of cOVRRenderContext.
Definition: OVRRenderContext.h:88
cTransform m_modelViewProjectionMatrix
Definition: OVRRenderContext.h:142
float m_left
Definition: OVRRenderContext.h:137
int m_width
Definition: OVRRenderContext.h:131
This class implements a rendering context using the SDL library.
Definition: OVRRenderContext.h:79
float m_fov
Definition: OVRRenderContext.h:127
int m_halfHeight
Definition: OVRRenderContext.h:134
float m_farPlane
Definition: OVRRenderContext.h:129
float m_right
Definition: OVRRenderContext.h:138
~cOVRRenderContext()
Destructor of cOVRRenderContext.
Definition: OVRRenderContext.h:105
SDL_GLContext context
Definition: OVRRenderContext.h:125
int m_height
Definition: OVRRenderContext.h:132
float m_top
Definition: OVRRenderContext.h:140
void init(const char *title, int x, int y, int w, int h)
Definition: OVRRenderContext.cpp:53