31
Support / Re: Screen orientation and camera
« on: September 27, 2012, 05:06:47 pm »
Egon, this is what the Rajawali engine does onSurfaceChanged():
And this is the camera setProjectionMatrix() method referenced above:
Can I replicate this in JPCT-AE ?
Code: [Select]
public void onSurfaceChanged(GL10 gl, int width, int height) {
mViewportWidth = width;
mViewportHeight = height;
mCamera.setProjectionMatrix(width, height);
GLES20.glViewport(0, 0, width, height);
}
And this is the camera setProjectionMatrix() method referenced above:
Code: [Select]
public void setProjectionMatrix(int width, int height) {
float ratio = (float) width / height;
float frustumH = MathUtil.tan(getFieldOfView() / 360.0f * MathUtil.PI) * getNearPlane();
float frustumW = frustumH * ratio;
Matrix.frustumM(mProjMatrix, 0, -frustumW, frustumW, -frustumH,
frustumH, getNearPlane(), getFarPlane());
}
Can I replicate this in JPCT-AE ?