Created
March 1, 2013 09:51
-
-
Save PaulWoodIII/5063620 to your computer and use it in GitHub Desktop.
was changing the cocos2d project matrix didn't work and this is fugly code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void) updateProjection{ | |
CGSize size = [[CCDirector sharedDirector] winSizeInPixels]; | |
CGSize sizePoint = [[CCDirector sharedDirector] winSize]; | |
float zeye = [[CCDirector sharedDirector] getZEye]; | |
kmMat4 matrixPerspective, matrixLookup; | |
float stringPerspective[16]; | |
[_stringOGL getProjectionMatrix:stringPerspective]; | |
kmMat4Fill(&matrixPerspective, stringPerspective); | |
// matrixPerspective.mat[0] = stringPerspective[0]; | |
// matrixPerspective.mat[1] = stringPerspective[1]; | |
// matrixPerspective.mat[2] = stringPerspective[2]; | |
// matrixPerspective.mat[3] = stringPerspective[3]; | |
// matrixPerspective.mat[4] = stringPerspective[4]; | |
// matrixPerspective.mat[5] = stringPerspective[5]; | |
// matrixPerspective.mat[6] = stringPerspective[6]; | |
// matrixPerspective.mat[7] = stringPerspective[7]; | |
// matrixPerspective.mat[8] = stringPerspective[8]; | |
// matrixPerspective.mat[9] = stringPerspective[9]; | |
// matrixPerspective.mat[10] = stringPerspective[10]; | |
// matrixPerspective.mat[11] = stringPerspective[11]; | |
// matrixPerspective.mat[12] = stringPerspective[12]; | |
// matrixPerspective.mat[13] = stringPerspective[13]; | |
// matrixPerspective.mat[14] = stringPerspective[14]; | |
// matrixPerspective.mat[15] = stringPerspective[15]; | |
kmGLMatrixMode(KM_GL_PROJECTION); | |
kmGLLoadIdentity(); | |
// issue #1334 | |
//kmMat4PerspectiveProjection( &matrixPerspective, 60, (GLfloat)size.width/size.height, -1.0f, 1.0f); | |
// kmMat4PerspectiveProjection( &matrixPerspective, 60, (GLfloat)size.width/size.height, 0.1f, 1500); | |
kmGLMultMatrix(&matrixPerspective); | |
kmGLMatrixMode(KM_GL_MODELVIEW); | |
kmGLLoadIdentity(); | |
kmVec3 eye, center, up; | |
kmVec3Fill( &eye, sizePoint.width/2, sizePoint.height/2, zeye ); | |
kmVec3Fill( ¢er, sizePoint.width/2, sizePoint.height/2, 0 ); | |
kmVec3Fill( &up, 0, 1, 0); | |
kmMat4LookAt(&matrixLookup, &eye, ¢er, &up); | |
kmGLMultMatrix(&matrixLookup); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment