Skip to content

Commit

Permalink
fix: centers image
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardoquesada committed May 14, 2016
1 parent ba0fdb8 commit 113c7de
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cocos/vr/CCVRGeneric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,12 @@ void VRGeneric::renderDistortionMesh(DistortionMesh *mesh, GLint textureID)

DistortionMesh* VRGeneric::createDistortionMesh(VREye::EyeType eyeType)
{
auto vp = Camera::getDefaultViewport();

const float screenWidth = _texSize.width;
const float screenHeight = _texSize.height;
const float xEyeOffsetScreen = (eyeType == VREye::LEFT) ? screenWidth/4 : screenWidth/4*3;
const float yEyeOffsetScreen = screenHeight/2;
const float xEyeOffsetScreen = (eyeType == VREye::LEFT) ? screenWidth/4 + vp._left : screenWidth/4*3 + vp._left;
const float yEyeOffsetScreen = screenHeight/2 + vp._bottom;

const float textureWidth = _texSize.width;
const float textureHeight = _texSize.height;
Expand All @@ -161,8 +163,6 @@ DistortionMesh* VRGeneric::createDistortionMesh(VREye::EyeType eyeType)
const float viewportW = textureWidth/2;
const float viewportH = textureHeight;



return new DistortionMesh(_distortion,
screenWidth, screenHeight,
xEyeOffsetScreen, yEyeOffsetScreen,
Expand Down

0 comments on commit 113c7de

Please sign in to comment.