src/main.cpp
/* This handles creating a view matrix for the Vita */
This handles creating a view matrix for the Vita
This handles creating a view matrix for the Vita
int initViewMatrix(void)
{
    mvpLoc = glGetUniformLocation(program, "u_mvpMat");
    positionLoc = glGetAttribLocation(program, "a_position");
    colorLoc = glGetAttribLocation(program, "a_color");
    glGenBuffers(1, &vertexID);
    glBindBuffer(GL_ARRAY_BUFFER, vertexID);
    glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices,
                GL_STATIC_DRAW);
    glGenBuffers(1, &colorID);
    glBindBuffer(GL_ARRAY_BUFFER, colorID);
    glBufferData(GL_ARRAY_BUFFER, sizeof(colors), colors,
                GL_STATIC_DRAW);
    projectionMat = (glMatrix*)malloc( sizeof(glMatrix) );
    loadIdentity( projectionMat );
    GLfloat aspect = (float)surface_width/(float)surface_height;
    GLfloat near = -1.0f;
    GLfloat far  = 1.0f;
    GLfloat yFOV  = 75.0f;
    GLfloat height = tanf( yFOV / 360.0f * M_PI ) * near;
    GLfloat width = height * aspect;
    frustumMatrix( projectionMat, -width, width, -height, height, near,
                far );
    if ( surface_width > surface_height ){
        scaleMatrix( projectionMat, (float)surface_height/(float)surface_width,
                    1.0f, 1.0f );
    } else {
        scaleMatrix( projectionMat, 1.0f,
                    (float)surface_width/(float)surface_height, 1.0f );
    }
    modelviewMat = (glMatrix*)malloc( sizeof(glMatrix) );
    loadIdentity( modelviewMat );
    mvpMat = (glMatrix*)malloc( sizeof(glMatrix) );
    return 0;
}
int initViewMatrix ( void ) { mvpLoc = glGetUniformLocation ( program , " " ) ; positionLoc = glGetAttribLocation ( program , " " ) ; colorLoc = glGetAttribLocation ( program , " " ) ; glGenBuffers ( 1 , & vertexID ) ; glBindBuffer ( GL_ARRAY_BUFFER , vertexID ) ; glBufferData ( GL_ARRAY_BUFFER , sizeof ( vertices ) , vertices , GL_STATIC_DRAW ) ; glGenBuffers ( 1 , & colorID ) ; glBindBuffer ( GL_ARRAY_BUFFER , colorID ) ; glBufferData ( GL_ARRAY_BUFFER , sizeof ( colors ) , colors , GL_STATIC_DRAW ) ; projectionMat = ( glMatrix * ) malloc ( sizeof ( glMatrix ) ) ; loadIdentity ( projectionMat ) ; GLfloat aspect = ( float ) surface_width / ( float ) surface_height ; GLfloat near = -1.0f ; GLfloat far = 1.0f ; GLfloat yFOV = 75.0f ; GLfloat height = tanf ( yFOV / 360.0f * M_PI ) * near ; GLfloat width = height * aspect ; frustumMatrix ( projectionMat , - width , width , - height , height , near , far ) ; if ( surface_width > surface_height ) { scaleMatrix ( projectionMat , ( float ) surface_height / ( float ) surface_width , 1.0f , 1.0f ) ; } else { scaleMatrix ( projectionMat , 1.0f , ( float ) surface_width / ( float ) surface_height , 1.0f ) ; } modelviewMat = ( glMatrix * ) malloc ( sizeof ( glMatrix ) ) ; loadIdentity ( modelviewMat ) ; mvpMat = ( glMatrix * ) malloc ( sizeof ( glMatrix ) ) ; return 0 ; }
This handles creating a view matrix for the Vita
This handles creating a view matrix for the Vita
/* Generate vertex and color buffers and fill with data */