@@ -64,6 +64,7 @@ void GLRStereoNormal::onSurfaceCreated(JNIEnv * env,jobject androidContext,jobje
64
64
Extensions2::init ();
65
65
KHR_debug::enable ();
66
66
//
67
+ #ifdef USE_INTERMEDIATE_DISTORTION
67
68
GLHelper::checkGlError (" onSurfaceCreated1" );
68
69
mTextureRenderer =std::make_unique<GLProgramTexture>(false ,&distortionManager);
69
70
// Create render texture.
@@ -86,6 +87,7 @@ void GLRStereoNormal::onSurfaceCreated(JNIEnv * env,jobject androidContext,jobje
86
87
MLOGE<<" Framebuffer not complete " <<status;
87
88
}
88
89
glBindFramebuffer (GL_FRAMEBUFFER,0 );
90
+ #endif
89
91
GLHelper::checkGlError (" onSurfaceCreated2" );
90
92
}
91
93
@@ -146,16 +148,19 @@ void GLRStereoNormal::onDrawFrame(JNIEnv* env) {
146
148
#ifdef CHANGE_SWAP_COLOR
147
149
GLHelper::updateSetClearColor (swapColor);
148
150
#endif
151
+ #ifdef USE_INTERMEDIATE_DISTORTION
149
152
glBindFramebuffer (GL_FRAMEBUFFER,framebuffer_);
150
153
glClearColor (1 ,0 ,0 ,0 .5f );
151
154
glScissor (0 ,0 ,RENDER_TEX_W,RENDER_TEX_H);
152
155
glViewport (0 ,0 ,RENDER_TEX_W,RENDER_TEX_H);
153
156
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
157
+ distortionManager.updateDistortionWithIdentity ();
154
158
mOSDRenderer ->updateAndDrawElementsGL (glm::mat4 (1 .0f ), glm::perspective (80 .0f ,(GLfloat)RENDER_TEX_W/(GLfloat)RENDER_TEX_H,0 .01f ,1000 .0f ));
159
+ vrHeadsetParams.updateDistortionManager (distortionManager);
155
160
glFlush ();
156
161
glBindFramebuffer (GL_FRAMEBUFFER,0 );
157
162
glClearColor (0 ,0 ,0 ,0 );
158
-
163
+ # endif
159
164
if (checkAndResetVideoFormatChanged ()){
160
165
placeGLElements ();
161
166
}
@@ -232,13 +237,15 @@ void GLRStereoNormal::drawEye(JNIEnv* env,gvr::Eye eye,bool updateOSDBetweenEyes
232
237
// glBlendEquation(GL_FUNC_ADD);
233
238
mVideoRenderer ->drawVideoCanvas (viewVideo, projection, eye == GVR_LEFT_EYE);
234
239
// new HA
240
+ #ifdef USE_INTERMEDIATE_DISTORTION
235
241
mTextureRenderer ->drawX (texture_,viewVideo,projection,mVideoRenderer ->mVideoCanvasB );
236
-
237
- /* if (eye == GVR_LEFT_EYE || updateOSDBetweenEyes) {
242
+ # else
243
+ if (eye == GVR_LEFT_EYE || updateOSDBetweenEyes) {
238
244
mOSDRenderer ->updateAndDrawElementsGL (viewOSD, projection);
239
245
} else {
240
246
mOSDRenderer ->drawElementsGL (viewOSD, projection);
241
- }*/
247
+ }
248
+ #endif
242
249
// glBlendFunc(GL_DST_ALPHA, GL_SRC_ALPHA);
243
250
// glBlendEquation(GL_FUNC_SUBTRACT);
244
251
// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
0 commit comments