28 #ifndef RENDERTHREAD_H
29 #define RENDERTHREAD_H
34 #include <boost/thread.hpp>
35 #include <boost/shared_ptr.hpp>
37 #include <boost/filesystem.hpp>
63 RenderThread(
WindowRef window,
AbstractMVREngine* engine,
AbstractMVRAppRef app, boost::barrier* swapBarrier, boost::mutex* initializedMutex, boost::condition_variable* initializedCondition, boost::mutex* startRenderingMutex, boost::mutex* renderingCompleteMutex, boost::condition_variable* startRenderingCond, boost::condition_variable* renderingCompleteCond);
75 void initExtensions();
76 void initStereoCompositeShader();
77 void initStereoFramebufferAndTextures();
78 void setShaderVariables();
84 int _numRenderingThreads;
85 boost::shared_ptr<boost::thread> _thread;
86 boost::barrier* _swapBarrier;
87 boost::mutex* _initMutex;
88 boost::mutex* _startRenderingMutex;
89 boost::mutex* _renderingCompleteMutex;
90 boost::condition_variable* _initCond;
91 boost::condition_variable* _startRenderingCond;
92 boost::condition_variable* _renderingCompleteCond;
96 GLuint _leftEyeTexture;
97 GLuint _rightEyeTexture;
99 GLhandleARB _stereoProgram;
100 GLfloat _fullscreenVertices[8];
101 GLuint _fullscreenIndices[4];
102 GLuint _vertexBuffer;
111 PFNGLGENFRAMEBUFFERSPROC pglGenFramebuffers;
112 PFNGLDELETEFRAMEBUFFERSPROC pglDeleteFramebuffers;
113 PFNGLBINDFRAMEBUFFERPROC pglBindFramebuffer;
114 PFNGLCHECKFRAMEBUFFERSTATUSPROC pglCheckFramebufferStatus;
115 PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC pglGetFramebufferAttachmentParameteriv;
116 PFNGLGENERATEMIPMAPPROC pglGenerateMipmap;
117 PFNGLFRAMEBUFFERTEXTURE2DPROC pglFramebufferTexture2D;
118 PFNGLFRAMEBUFFERRENDERBUFFERPROC pglFramebufferRenderbuffer;
120 PFNGLGENRENDERBUFFERSPROC pglGenRenderbuffers;
121 PFNGLDELETERENDERBUFFERSPROC pglDeleteRenderbuffers;
122 PFNGLBINDRENDERBUFFERPROC pglBindRenderbuffer;
123 PFNGLRENDERBUFFERSTORAGEPROC pglRenderbufferStorage;
124 PFNGLGETRENDERBUFFERPARAMETERIVPROC pglGetRenderbufferParameteriv;
125 PFNGLISRENDERBUFFERPROC pglIsRenderbuffer;
127 PFNGLCREATEPROGRAMPROC pglCreateProgram;
128 PFNGLCREATESHADERPROC pglCreateShader;
129 PFNGLSHADERSOURCEPROC pglShaderSource;
130 PFNGLCOMPILESHADERPROC pglCompileShader;
131 PFNGLGETOBJECTPARAMETERIVARBPROC pglGetObjectParameterivARB;
132 PFNGLATTACHSHADERPROC pglAttachShader;
133 PFNGLLINKPROGRAMPROC pglLinkProgram;
134 PFNGLGETSHADERIVPROC pglGetShaderiv;
135 PFNGLGETPROGRAMIVARBPROC pglGetProgramivARB;
136 PFNGLUSEPROGRAMPROC pglUseProgram;
137 PFNGLGETUNIFORMLOCATIONPROC pglGetUniformLocation;
138 PFNGLUNIFORM2FPROC pglUniform2f;
139 PFNGLUNIFORM1IPROC pglUniform1i;
141 PFNGLBINDBUFFERPROC pglBindBuffer;
142 PFNGLGENBUFFERSPROC pglGenBuffers;
143 PFNGLBUFFERDATAPROC pglBufferData;
145 PFNGLACTIVETEXTUREPROC pglActiveTexture;
147 #ifndef glGenFramebuffers
148 #define glGenFramebuffers pglGenFramebuffers
150 #ifndef glDeleteFramebuffers
151 #define glDeleteFramebuffers pglDeleteFramebuffers
153 #ifndef glBindFramebuffer
154 #define glBindFramebuffer pglBindFramebuffer
156 #ifndef glCheckFramebufferStatus
157 #define glCheckFramebufferStatus pglCheckFramebufferStatus
159 #ifndef glGetFramebufferAttachmentParameteriv
160 #define glGetFramebufferAttachmentParameteriv pglGetFramebufferAttachmentParameteriv
162 #ifndef glGenerateMipmap
163 #define glGenerateMipmap pglGenerateMipmap
165 #ifndef glFramebufferTexture2D
166 #define glFramebufferTexture2D pglFramebufferTexture2D
168 #ifndef glFramebufferRenderbuffer
169 #define glFramebufferRenderbuffer pglFramebufferRenderbuffer
172 #ifndef glGenRenderbuffers
173 #define glGenRenderbuffers pglGenRenderbuffers
175 #ifndef glDeleteRenderbuffers
176 #define glDeleteRenderbuffers pglDeleteRenderbuffers
178 #ifndef glBindRenderbuffer
179 #define glBindRenderbuffer pglBindRenderbuffer
181 #ifndef glRenderbufferStorage
182 #define glRenderbufferStorage pglRenderbufferStorage
184 #ifndef glGetRenderbufferParameteriv
185 #define glGetRenderbufferParameteriv pglGetRenderbufferParameteriv
187 #ifndef glIsRenderBuffer
188 #define glIsRenderbuffer pglIsRenderbuffer
191 #ifndef glCreateProgram
192 #define glCreateProgram pglCreateProgram
194 #ifndef glCreateShader
195 #define glCreateShader pglCreateShader
197 #ifndef glShaderSource
198 #define glShaderSource pglShaderSource
200 #ifndef glCompileShader
201 #define glCompileShader pglCompileShader
203 #ifndef glGetObjectParameterivARB
204 #define glGetObjectParameterivARB pglGetObjectParameterivARB
206 #ifndef glAttachShader
207 #define glAttachShader pglAttachShader
209 #ifndef glLinkProgram
210 #define glLinkProgram pglLinkProgram
212 #ifndef glGetShaderiv
213 #define glGetShaderiv pglGetShaderiv
215 #ifndef glGetProgramivARB
216 #define glGetProgramivARB pglGetProgramivARB
219 #define glUseProgram pglUseProgram
221 #ifndef glGetUniformLocation
222 #define glGetUniformLocation pglGetUniformLocation
225 #define glUniform2f pglUniform2f
228 #define glUniform1i pglUniform1i
232 #define glBindBuffer pglBindBuffer
235 #define glGenBuffers pglGenBuffers
238 #define glBufferData pglBufferData
241 #ifndef glActiveTexture
242 #define glActiveTexture pglActiveTexture