static void gluPerspective(GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat zFar) { GLfloat xmin, xmax, ymin, ymax; ymax = zNear * (GLfloat)tan(fovy * PI / 360); ymin = -ymax; xmin = ymin * aspect; xmax = ymax * aspect; glFrustumx((GLfixed)(xmin * 65536), (GLfixed)(xmax * 65536), (GLfixed)(ymin * 65536), (GLfixed)(ymax * 65536), (GLfixed)(zNear * 65536), (GLfixed)(zFar * 65536)); }
void gluPerspective(GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat zFar) { GLfloat xmin, xmax, ymin, ymax; ymax = zNear * (GLfloat)tan(fovy * PI / 360); ymin = -ymax; xmin = ymin * aspect; xmax = ymax * aspect; #ifndef GPAC_USE_GLES2 glFrustumx((GLfixed)(xmin * 65536), (GLfixed)(xmax * 65536), (GLfixed)(ymin * 65536), (GLfixed)(ymax * 65536), (GLfixed)(zNear * 65536), (GLfixed)(zFar * 65536)); #endif }
//============================================================================= //Setup GL //@returns TRUE on success, FALSE otherwise //============================================================================= boolean GLApp::SetupGL() { //smooth shading & depth test glShadeModel(GL_SMOOTH); glEnable(GL_DEPTH_TEST); //enable lighting operations GLfixed diffuse[] = { FTOX(1.0f), FTOX(1.0f), FTOX(1.0f), FTOX(1.0f) }; GLfixed lightPos[] = { FTOX(0.0f), FTOX(5.0f), FTOX(-5.0f) }; glEnable(GL_LIGHT0); glEnable(GL_COLOR_MATERIAL); glLightxv(GL_LIGHT0, GL_DIFFUSE, diffuse); glLightxv(GL_LIGHT0, GL_POSITION, lightPos); //enable blending operations glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); //enable fog operations GLfixed fogColor[] = { 0, 0, 0, ITOX(1) }; glFogxv(GL_FOG_COLOR, fogColor); glFogx(GL_FOG_MODE, GL_LINEAR); glFogx(GL_FOG_START, ITOX(10)); glFogx(GL_FOG_END, ITOX(70)); //perspective Correction glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); //GL Initialization glViewport(0, 0, m_DBitmapInfo.cx, m_DBitmapInfo.cy); //init Projection matrix glMatrixMode(GL_PROJECTION); glLoadIdentity(); glFrustumx(ITOX(-5), ITOX(5), ITOX(-5), ITOX(5), ITOX(10), ITOX(100)); //init Model-View matrix glMatrixMode(GL_MODELVIEW); glLoadIdentity(); if(glGetError() != GL_NO_ERROR) return FALSE; return TRUE; }
void glFrustumxLogged(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) { printf("glFrustumx(%i, %i, %i, %i, %i, %i)\n", left, right, bottom, top, zNear, zFar); glFrustumx(left, right, bottom, top, zNear, zFar); }