Are Cocos2dx projection and OpenGL projection different?

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;

kmGLMatrixMode(KM_GL_PROJECTION);
kmGLLoadIdentity();

// issue #1334
kmMat4PerspectiveProjection( &matrixPerspective, 60, (GLfloat)size.width/size.height, 0.1f, zeye*2);
kmGLMultMatrix(&matrixPerspective);

kmGLMatrixMode(KM_GL_MODELVIEW);
kmGLLoadIdentity();
kmVec3 eye, center, up;
kmVec3Fill( &eye, sizePoint.width/2, sizePoint.height/2, zeye );
kmVec3Fill( &center, sizePoint.width/2, sizePoint.height/2, 0.0f );
kmVec3Fill( &up, 0.0f, 1.0f, 0.0f);
kmMat4LookAt(&matrixLookup, &eye, &center, &up);
kmGLMultMatrix(&matrixLookup);


and my example is projected like it.



int w = 480;
int h = 320;

glMatrixMode(GL_PROJECTION);
glLoadIdentity();

gluPerspective(60, w/h, 0.1, zeye*2);

Vec3Fill( &eye, w/2, h/2, zeye*2 );
Vec3Fill( &center, w/2, h/2, 0 );
Vec3Fill( &up, 0, 1, 0 );

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

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)