I’m making opengl example about perspective projection like cocos2dx.
but my example is not same with cocos2dx.
This is how cocos2dx is projected.
float zeye = this->GetZEye();
kmMat4 matrixPerspective, matrixLookup;
// issue #1334
kmMat4PerspectiveProjection( &matrixPerspective, 60, (GLfloat)size.width/size.height, 0.1f, zeye*2);
kmVec3 eye, center, up;
kmVec3Fill( &eye, sizePoint.width/2, sizePoint.height/2, zeye );
kmVec3Fill( ¢er, sizePoint.width/2, sizePoint.height/2, 0.0f );
kmVec3Fill( &up, 0.0f, 1.0f, 0.0f);
kmMat4LookAt(&matrixLookup, &eye, ¢er, &up);
and my example is projected like it.
int w = 480;
int h = 320;
gluPerspective(60, w/h, 0.1, zeye*2);
Vec3Fill( &eye, w/2, h/2, zeye*2 );
Vec3Fill( ¢er, w/2, h/2, 0 );
Vec3Fill( &up, 0, 1, 0 );
gluLookAt(eye.x,eye.y,eye.z, center.x,center.y,center.z, up.x,up.y,up.z);
zeye value is same.
but Result is NOT SAME.
I drew two rectangle. In cocos2dx, two rectangle was drew well.
But my example was not. opengl was drawing two rectangle more closely. (So one rectangle showed only partially.)
If camera eye position is more bigger, I can see right shapes.
(Please look at the attached file.)
Why this happens because any difference about opengl with cocos2dx?
2012-12-19 오후 4-16-15.png (80.2 KB)