jPCT-AE - a 3d engine for Android > Support

Combine JPCT and OpenGL ES API

(1/2) > >>

mazelin:
Hi, all
    When I use JPCT API, can i also use OpenGL ES API.For examples, I want to use follow code to update PROJECTION View.
gl.glMatrixMode(GL10.GL_PROJECTION);
FloatBuffer floatBuffer = FloatBuffer.wrap(new float[]{//data......});
gl.glLoadMatrixf(floatBuffer);
It will work?
Thanks!

EgonOlsen:
No, that won't work. You might be able to do in the beforeRendering()-method of an IRenderHook, if you do it per object. But it will interfere with the gross culling of the engine if it's too far away from the actual projection matrix. Why do you want to do this anyway?

mazelin:
Hi,
   Thank you for reply. I want to change camera PROJECTION View, but I can't find the interface from JPCT-AE.
I calibration camera for android and compute the camera matrix. Then I want to configure PROJECTION View. How can I do it in JPCT-AE?
Thank you again.

EgonOlsen:
I'm not sure what a projection matrix has to do with the device's camera. You can set the fov in the Camera class, if that is what you are looking for...

mazelin:
I mean like this:
public void onSurfaceChanged(GL10 gl, int width, int height) {
    gl.glViewport(0, 0, width, height);

    // make adjustments for screen ratio
    float ratio = (float) width / height;
    gl.glMatrixMode(GL10.GL_PROJECTION);        // set matrix to projection mode
    gl.glLoadIdentity();                                        // reset the matrix to its default state
    gl.glFrustumf(-ratio, ratio, -1, 1, 3, 7);           // apply the projection matrix   //The data will change for different device's camera.
}
So, I can't do it like this, if i use JPCT-AE?
Thank you!

Navigation

[0] Message Index

[#] Next page

Go to full version