void initMatrices() { theta = 0.0f; gama = 0.0f; scaleAmount = 1.0f; // Allocate memory for the matrices and initialize them to the Identity matrix rotXMatrix = new GLfloat[16]; makeIdentity(rotXMatrix); rotYMatrix = new GLfloat[16]; makeIdentity(rotYMatrix); rotZMatrix = new GLfloat[16]; makeIdentity(rotZMatrix); allRotsMatrix = new GLfloat[16]; makeIdentity(allRotsMatrix); transMatrix = new GLfloat[16]; makeIdentity(transMatrix); transMatrix2 = new GLfloat[16]; makeIdentity(transMatrix); scaleMatrix = new GLfloat[16]; makeIdentity(scaleMatrix); tempMatrix1 = new GLfloat[16]; makeIdentity(tempMatrix1); tempMatrix2 = new GLfloat[16]; makeIdentity(tempMatrix1); M = new GLfloat[16]; makeIdentity(M); V = new GLfloat[16]; makeIdentity(V); P = new GLfloat[16]; makeIdentity(P); // Set up the (P)erspective matrix only once! Arguments are 1) the resulting matrix, 2) FoV, 3) aspect ratio, 4) near plane 5) far plane makePerspectiveMatrix(P, 40.0f, 1.0f, 1.0f, 1000.0f); //makeOrtho(P,-1.0f,1.0f,-1.0f,1.0f,1.0f,1000.0f); }
void Window::setContext() { glfwGetWindowSize(windowHandle,&width,&height); makePerspectiveMatrix(&game->shaderManager->frameData.projectionMatrix,float(width)/height); glfwMakeContextCurrent(windowHandle); glViewport(0,0,width,height); }