PDA

View Full Version : Grab Projection and view Matrices without glGet*



MomTarsh
03-24-2011, 12:30 PM
Hello,

seeing as I have found out GLES 1.0 is not compatible with the glGet*
functions, how can I store this internally in my app? here is a code
example

void Camera::SetProjectionMatrix(float aspect, float fov, float
nearPlane, float farPlane)
{
glMatrixMode(GL_PROJECTION);
float top, bottom, left, right;

top = tan(fov*0.5) * nearPlane;
bottom = -top;
left = aspect * bottom;
right = aspect * top;

glLoadIdentity();
glFrustumf(left,right,bottom,top,nearPlane,farPlan e);
glMatrixMode(GL_MODELVIEW);
m_dirty = true;
}

I am using GLES 1.0 and am using native OpenGL for the Android.

Thanks alot

V-man
03-24-2011, 04:39 PM
This is a function that computes the matrix and returns it to you
http://www.opengl.org/wiki/GluPerspective_code

There are other math and matrix libraries as well. A long list is here
http://www.gamedev.net/topic/291432-list-of-free-libraries/

There is a GLU version for GL ES. I think it is called GLU ES. Check out the forums at http://www.khronos.org