OpenGLES and very small FOV_Y for perspective projection
up vote
0
down vote
favorite
I'm working on OpenGL ES 2.0 on an Android augmented reality app. My goal is to display a virtual object (for now, a rectangle) at a given position to give the impression that it has a real location in the world. So far, Im able to display a blue rectangle where I want (for example, at point (0;0.5;-1) in meters).
When I rotate the head, the rectangle goes in the opposite direction, which is the expected behaviour. However, it is not "fast enough" : I can still see half of it when I should not be able to see it at all because I'm facing another direction.
My first thought was that the issue was related to a too big FOV when I create the projection Matrix. As shown below, I'm using perspective projection :
@Override
public void onSurfaceChanged(GL10 unused, int width, int height)
GLES20.glViewport(0, 0, (float)width, (float)height);
Matrix.setIdentityM(mProjectionMatrix, 0);
Matrix.perspectiveM(mProjectionMatrix, 0, mFOV_Y, DisplayConst.SCREEN_RATIO, mZNear, DisplayConst.GLASSES_FAR_PLANE);
// mFOV_Y: 12.0f (degrees); screenRatio: 1.8f; nearPlane: 0.01f; farPlane: 100.0f (meters);
However, even with the theoretical FOV_Y of the AR headset I am using, the issue is still there. I need to give a really low value (+-3°) to approximate something correct, which troubles me because I think it does not correspond to the real value.
For the OpenGL camera, I update at each drawing step both the eyePos and LookAt parameters according to the pose of the AR headset, and this part appears to work as expected.
Did I miss something I the view or projection matrix which could cause this kind of effect ?
android opengl-es
add a comment |
up vote
0
down vote
favorite
I'm working on OpenGL ES 2.0 on an Android augmented reality app. My goal is to display a virtual object (for now, a rectangle) at a given position to give the impression that it has a real location in the world. So far, Im able to display a blue rectangle where I want (for example, at point (0;0.5;-1) in meters).
When I rotate the head, the rectangle goes in the opposite direction, which is the expected behaviour. However, it is not "fast enough" : I can still see half of it when I should not be able to see it at all because I'm facing another direction.
My first thought was that the issue was related to a too big FOV when I create the projection Matrix. As shown below, I'm using perspective projection :
@Override
public void onSurfaceChanged(GL10 unused, int width, int height)
GLES20.glViewport(0, 0, (float)width, (float)height);
Matrix.setIdentityM(mProjectionMatrix, 0);
Matrix.perspectiveM(mProjectionMatrix, 0, mFOV_Y, DisplayConst.SCREEN_RATIO, mZNear, DisplayConst.GLASSES_FAR_PLANE);
// mFOV_Y: 12.0f (degrees); screenRatio: 1.8f; nearPlane: 0.01f; farPlane: 100.0f (meters);
However, even with the theoretical FOV_Y of the AR headset I am using, the issue is still there. I need to give a really low value (+-3°) to approximate something correct, which troubles me because I think it does not correspond to the real value.
For the OpenGL camera, I update at each drawing step both the eyePos and LookAt parameters according to the pose of the AR headset, and this part appears to work as expected.
Did I miss something I the view or projection matrix which could cause this kind of effect ?
android opengl-es
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm working on OpenGL ES 2.0 on an Android augmented reality app. My goal is to display a virtual object (for now, a rectangle) at a given position to give the impression that it has a real location in the world. So far, Im able to display a blue rectangle where I want (for example, at point (0;0.5;-1) in meters).
When I rotate the head, the rectangle goes in the opposite direction, which is the expected behaviour. However, it is not "fast enough" : I can still see half of it when I should not be able to see it at all because I'm facing another direction.
My first thought was that the issue was related to a too big FOV when I create the projection Matrix. As shown below, I'm using perspective projection :
@Override
public void onSurfaceChanged(GL10 unused, int width, int height)
GLES20.glViewport(0, 0, (float)width, (float)height);
Matrix.setIdentityM(mProjectionMatrix, 0);
Matrix.perspectiveM(mProjectionMatrix, 0, mFOV_Y, DisplayConst.SCREEN_RATIO, mZNear, DisplayConst.GLASSES_FAR_PLANE);
// mFOV_Y: 12.0f (degrees); screenRatio: 1.8f; nearPlane: 0.01f; farPlane: 100.0f (meters);
However, even with the theoretical FOV_Y of the AR headset I am using, the issue is still there. I need to give a really low value (+-3°) to approximate something correct, which troubles me because I think it does not correspond to the real value.
For the OpenGL camera, I update at each drawing step both the eyePos and LookAt parameters according to the pose of the AR headset, and this part appears to work as expected.
Did I miss something I the view or projection matrix which could cause this kind of effect ?
android opengl-es
I'm working on OpenGL ES 2.0 on an Android augmented reality app. My goal is to display a virtual object (for now, a rectangle) at a given position to give the impression that it has a real location in the world. So far, Im able to display a blue rectangle where I want (for example, at point (0;0.5;-1) in meters).
When I rotate the head, the rectangle goes in the opposite direction, which is the expected behaviour. However, it is not "fast enough" : I can still see half of it when I should not be able to see it at all because I'm facing another direction.
My first thought was that the issue was related to a too big FOV when I create the projection Matrix. As shown below, I'm using perspective projection :
@Override
public void onSurfaceChanged(GL10 unused, int width, int height)
GLES20.glViewport(0, 0, (float)width, (float)height);
Matrix.setIdentityM(mProjectionMatrix, 0);
Matrix.perspectiveM(mProjectionMatrix, 0, mFOV_Y, DisplayConst.SCREEN_RATIO, mZNear, DisplayConst.GLASSES_FAR_PLANE);
// mFOV_Y: 12.0f (degrees); screenRatio: 1.8f; nearPlane: 0.01f; farPlane: 100.0f (meters);
However, even with the theoretical FOV_Y of the AR headset I am using, the issue is still there. I need to give a really low value (+-3°) to approximate something correct, which troubles me because I think it does not correspond to the real value.
For the OpenGL camera, I update at each drawing step both the eyePos and LookAt parameters according to the pose of the AR headset, and this part appears to work as expected.
Did I miss something I the view or projection matrix which could cause this kind of effect ?
android opengl-es
android opengl-es
asked Nov 8 at 17:18
C.IHM
114
114
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53212983%2fopengles-and-very-small-fov-y-for-perspective-projection%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown