- March 12, 2010 at 5:53 pm #30075
I’m using the 3_00_00_06 SDK from TI for OMAP3530. I have a simple gles2 app with a shader which works fine using a projection matrix. I can rotate my model 45 degrees and get expected results. When I use a PVRT::Mat4::Ortho() I end up with an unsatisfying blank screen. In other words,
// this works:
float aspect = screenWidth/screenHeight;
bool bRotate = false;
PVRT::Mat4::PerspectiveFovFloatDepthRH(PI/6.0, aspect, 1.0, PVRT::Mat4::OGL, bRotate);
// this doesn’t work:
PVRT::Mat4::Ortho(screenWidth/-2.0, screenHeight/2.0, screenWidth/2.0, screenHeight/-2.0, NEAR_CLIP, FAR_CLIP, PVRT::Mat4::OGL, bRotate);
Is there an example app which uses an orthographic projection? A grep in the SDK sources didn’t turn up anything.
Another data point: when I just use a rotation matrix of .001 degrees around the Y axis, (no additional perspective or ortho matrix) I get a thin vertical block of pixels suggesting depth clipping is against me. I assume this will go away once proper near/far planes are set.
Thanks!August 27, 2010 at 3:58 am #33771
Perspective has another “scale” factory. So if you have small triangle created with size around 1.0f it will be as 1px in screen in Ortho mode.
Try to use -1, 1, 1, -1 for left, top, right, bottom, and you will get similar result to Perspective ( considering scale ).
But if you want Ortho for creating HUD, you will need to scale up your objects.
You asked also for exmaple, Ortho is used in Water Demo.September 10, 2010 at 11:26 pm #33772
Hi michax. Thanks for your reply.
I was not able to find source for the water or sailboat demo in the SDK nor elsewhere, but I had another look at using PVRTMatrixOrthoRHF() and it seems to be doing what I need. I started with the 02_HelloTriangle example in the GLES2 training, passed the matrix generated by PVRTMatrixOrthoRHF() to glUniformMatrix4fv() instead of the identity matrix and got expected results.September 17, 2010 at 11:31 am #33773
Please post further if you encounter any difficulties. Incidentally, the Water demo should be here, in the SDK: