// Called to draw scene void RenderScene(void) { static GLfloat yRot = 0.0f; // Rotation angle for animation yRot += 0.5f; // Clear the window with current clearing color glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); gltApplyCameraTransform(&frameCamera); glTranslatef(0.0f, 1.4f, -2.5f); //view initial position glScalef(4.0f,4.0f,4.0f); //enlarge glLightfv(GL_LIGHT0,GL_POSITION,fLightPos); DrawSky(tex.get_texture(SKY_TEXTURE)); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, tex.get_texture(GROUND_TEXTURE)); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glColor3f(0.9f,0.9f,0.9f); gmm.DrawGround(); /* glDisable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); glDisable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glPushMatrix(); glMultMatrixf(mShadowMatrix); gmm.DrawGym(1); glPopMatrix(); glDisable(GL_BLEND); glEnable(GL_LIGHTING); glEnable(GL_DEPTH_TEST); */ gmm.DrawGym(0); DrawEarth(tex.get_texture(EARTH_TEXTURE)); //debug show /* glPushMatrix(); glTranslatef(fLightPos[0],fLightPos[1], fLightPos[2]); glColor3ub(240,240,0); glutSolidSphere(0.6f,10,10); glPopMatrix(); */ glPopMatrix(); glutSwapBuffers(); glutPostRedisplay(); }
void GLApp::displayWorld() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadMatrixf(camera.GetMatrix()); gen_clipmat(); glGetIntegerv(GL_VIEWPORT, viewPort); glGetDoublev(GL_MODELVIEW_MATRIX, modelViewMatrix); glGetDoublev(GL_PROJECTION_MATRIX, projectionMatrix); glEnable(GL_TEXTURE_2D); DrawSky(); DrawSea(); terrain.Render(camera.position);//(); Environment::instance().Render(); pman.Render(); checkError("displayWorld"); }
//Output void cGame::Render() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0,(float)SCREEN_WIDTH/(float)SCREEN_HEIGHT,0.01,100); glMatrixMode(GL_MODELVIEW); DrawSky(); if(!Scene.IsInitialized) { DrawStartScreen(); } else { DrawGame(); } if (WireframeRendering) DrawWireframeGame(); if (IsGameover) DrawGameOver(); if (IsLevelUp) DrawLevelUp(); glutSwapBuffers(); UpdateFrameVariables(); }
void CTexture::Rebuild() { int i, j; int x, y; int name_num, prefix_num, suffix_num; int max_size; float radius; GLvector2 pos; bool use_framebuffer; unsigned char* bits; unsigned start; int lapsed; start = GetTickCount(); //Since we make textures by drawing into the viewport, we can't make them bigger //than the current view. _size = _desired_size; max_size = RenderMaxTextureSize(); while (_size > max_size) _size /= 2; glBindTexture(GL_TEXTURE_2D, _glid); //Set up the texture glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _size, _size, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); if (_clamp) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); } //Set up our viewport so that drawing into our texture will be as easy //as possible. We make the viewport and projection simply match the given //texture size. glViewport(0, 0, _size, _size); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, _size, _size, 0, 0.1f, 2048); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glDisable(GL_CULL_FACE); glDisable(GL_FOG); glBindTexture(GL_TEXTURE_2D, 0); glTranslatef(0, 0, -10.0f); glClearColor(0, 0, 0, _masked ? 0.0f : 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); use_framebuffer = true; glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); switch (_my_id) { case TEXTURE_LATTICE: glLineWidth(2.0f); glColor3f(0, 0, 0); glBegin(GL_LINES); glVertex2i(0, 0); glVertex2i(_size, _size); //diagonal glVertex2i(0, 0); glVertex2i(0, _size); //vertical glVertex2i(0, 0); glVertex2i(_size, 0); //vertical glEnd(); glBegin(GL_LINE_STRIP); glVertex2i(0, 0); for (i = 0; i < _size; i += 9) { if (i % 2) glVertex2i(0, i); else glVertex2i(i, i); } for (i = 0; i < _size; i += 9) { if (i % 2) glVertex2i(i, 0); else glVertex2i(i, i); } glEnd(); break; case TEXTURE_SOFT_CIRCLE: //Make a simple circle of light, bright in the center and fading out glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); radius = ((float)_half) - 3; glBegin(GL_TRIANGLE_FAN); glColor4f(1, 1, 1, 1); glVertex2i(_half, _half); glColor4f(0, 0, 0, 0); for (i = 0; i <= 360; i++) { pos.x = sinf((float)i * DEGREES_TO_RADIANS) * radius; pos.y = cosf((float)i * DEGREES_TO_RADIANS) * radius; glVertex2i(_half + (int)pos.x, _half + (int)pos.y); } glEnd(); break; case TEXTURE_LIGHT: glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); radius = ((float)_half) - 3; for (j = 0; j < 2; j++) { glBegin(GL_TRIANGLE_FAN); glColor4f(1, 1, 1, 1); glVertex2i(_half, _half); if (!j) radius = ((float)_half / 2); else radius = 8; glColor4f(1, 1, 1, 0); for (i = 0; i <= 360; i++) { pos.x = sinf((float)i * DEGREES_TO_RADIANS) * radius; pos.y = cosf((float)i * DEGREES_TO_RADIANS) * radius; glVertex2i(_half + (int)pos.x, _half + (int)pos.y); } glEnd(); } break; case TEXTURE_HEADLIGHT: DrawHeadlight(); break; case TEXTURE_LOGOS: i = 0; glDepthMask(false); glDisable(GL_BLEND); name_num = RandomVal(NAME_COUNT); prefix_num = RandomVal(PREFIX_COUNT); suffix_num = RandomVal(SUFFIX_COUNT); glColor3f(1, 1, 1); while (i < _size) { //randomly use a prefix OR suffix, but not both. Too verbose. if (COIN_FLIP) RenderPrint(2, _size - i - LOGO_PIXELS / 4, RandomVal(), glRgba(1.0f), "%s%s", prefix[prefix_num], name[name_num]); else RenderPrint(2, _size - i - LOGO_PIXELS / 4, RandomVal(), glRgba(1.0f), "%s%s", name[name_num], suffix[suffix_num]); name_num = (name_num + 1) % NAME_COUNT; prefix_num = (prefix_num + 1) % PREFIX_COUNT; suffix_num = (suffix_num + 1) % SUFFIX_COUNT; i += LOGO_PIXELS; } break; case TEXTURE_TRIM: int margin; y = 0; margin = MAX(TRIM_PIXELS / 4, 1); for (x = 0; x < _size; x += TRIM_PIXELS) drawrect_simple(x + margin, y + margin, x + TRIM_PIXELS - margin, y + TRIM_PIXELS - margin, glRgba(1.0f), glRgba(0.5f)); y += TRIM_PIXELS; for (x = 0; x < _size; x += TRIM_PIXELS * 2) drawrect_simple(x + margin, y + margin, x + TRIM_PIXELS - margin, y + TRIM_PIXELS - margin, glRgba(1.0f), glRgba(0.5f)); y += TRIM_PIXELS; for (x = 0; x < _size; x += TRIM_PIXELS * 3) drawrect_simple(x + margin, y + margin, x + TRIM_PIXELS - margin, y + TRIM_PIXELS - margin, glRgba(1.0f), glRgba(0.5f)); y += TRIM_PIXELS; for (x = 0; x < _size; x += TRIM_PIXELS) drawrect_simple(x + margin, y + margin * 2, x + TRIM_PIXELS - margin, y + TRIM_PIXELS - margin, glRgba(1.0f), glRgba(0.5f)); break; case TEXTURE_SKY: DrawSky(); break; default: //building textures DrawWindows(); break; } glPopMatrix(); //Now blit the finished image into our texture if (use_framebuffer) { glBindTexture(GL_TEXTURE_2D, _glid); glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, _size, _size, 0); } if (_mipmap) { bits = (unsigned char*)malloc(_size * _size * 4); glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, bits); gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, _size, _size, GL_RGBA, GL_UNSIGNED_BYTE, bits); free(bits); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); } else glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); //cleanup and restore the viewport RenderResize(); _ready = true; lapsed = GetTickCount() - start; build_time += lapsed; }
void DrawPlateau() { glColor3f(1.0,1.0,1.0); glClearColor (1.0,1.0,1.0,1.0); glEnable(GL_TEXTURE_2D); chargerTextures(0,"texture/sombre.tga"); chargerTextures(1,"texture/wood_wide1.tga"); glBindTexture(GL_TEXTURE_2D, aTexture[0].texID); //les bords superieur glBegin(GL_QUADS); glTexCoord2i(1,1); glVertex3f(-1.0,0.0,-1.0); //a ----> 1point de la grille glTexCoord2i(0,1); glVertex3f(-1.058,0.0,-1.058); //A glTexCoord2i(0,0); glVertex3f(-1.058,0.0,1.058); //B glTexCoord2i(1,0); glVertex3f(-1.0,0.0,1.0);//b ----> 2point de la grille glTexCoord2i(1,1); glVertex3f(-1.0,0.0,1.0);//b glTexCoord2i(0,1); glVertex3f(-1.058,0.0,1.058);//B glTexCoord2i(0,0); glVertex3f(1.058,0.0,1.058);//C glTexCoord2i(1,0); glVertex3f(1.0,0.0,1.0);//c ----> 3point de la grille glTexCoord2i(1,1); glVertex3f(1.0,0.0,1.0);//c glTexCoord2i(0,1); glVertex3f(1.058,0.0,1.058);//C glTexCoord2i(0,0); glVertex3f(1.058,0.0,-1.058);//D glTexCoord2i(1,0); glVertex3f(1.0,0.0,-1.0);//d glTexCoord2i(1,1); glVertex3f(1.0,0.0,-1.0);//d ----> 4point de la grille glTexCoord2i(0,1); glVertex3f(1.058,0.0,-1.058);//D glTexCoord2i(0,0); glVertex3f(-1.058,0.0,-1.058);//A glTexCoord2i(1,0); glVertex3f(-1.0,0.0,-1.0); //a glEnd(); //les bords lateral glBegin(GL_QUADS); glTexCoord2i(1,1); glVertex3f(-1.058,0.0,-1.058);//A glTexCoord2i(0,1); glVertex3f(-1.058,-0.02,-1.058); //A2 glTexCoord2i(0,0); glVertex3f(-1.058,-0.02,1.058); //B2 glTexCoord2i(1,0); glVertex3f(-1.058,0.0,1.058);//B glTexCoord2i(1,1); glVertex3f(-1.058,0.0,1.058);//B glTexCoord2i(0,1); glVertex3f(-1.058,-0.02,1.058);//B2 glTexCoord2i(0,0); glVertex3f(1.058,-0.02,1.058);//C2 glTexCoord2i(1,0); glVertex3f(1.058,0.0,1.058);//C glTexCoord2i(1,1); glVertex3f(1.058,0.0,1.058);//C glTexCoord2i(0,1); glVertex3f(1.058,-0.02,1.058);//C2 glTexCoord2i(0,0); glVertex3f(1.058,-0.02,-1.058);//D2 glTexCoord2i(1,0); glVertex3f(1.058,0.0,-1.058);//D glTexCoord2i(1,1); glVertex3f(1.058,0.0,-1.058);//D glTexCoord2i(0,1); glVertex3f(1.058,-0.02,-1.058);//D2 glTexCoord2i(0,0); glVertex3f(-1.058,-0.02,-1.058); //A2 glTexCoord2i(1,0); glVertex3f(-1.058,0.0,-1.058); //A glEnd(); if(reflet) { glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor4f(1.0,1.0,1.0,0.5); glClearColor (1.0,1.0,1.0,0.5); } //la face posterieur glBegin(GL_QUADS); glTexCoord2i(1,1); glVertex3f(-1.058,-0.02,-1.058); glTexCoord2i(0,1); glVertex3f(-1.058,-0.02,1.058); glTexCoord2i(0,0); glVertex3f(1.058,-0.02,1.058); glTexCoord2i(1,0); glVertex3f(1.058,-0.02,-1.058); glEnd(); DrawGrille(); if(reflet) { glDisable(GL_BLEND); glColor3f(1.0,1.0,1.0); glClearColor (1.0,1.0,1.0,1.0); } DrawSky(); glDeleteTextures(1, &aTexture[0].texID); glDeleteTextures(1, &aTexture[1].texID); glDisable(GL_TEXTURE_2D); //le plan de pojection de l'ombre vfloor[0][0]=-1.058; vfloor[0][1]=0.0001; vfloor[0][2]=-1.058; vfloor[1][0]=-1.058; vfloor[1][1]=0.0001; vfloor[1][2]=1.058; vfloor[2][0]=1.058; vfloor[2][1]=0.0001; vfloor[2][2]=1.058; vfloor[3][0]=1.058; vfloor[3][1]=0.0001; vfloor[3][2]=-1.058; }
void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //清空颜色缓冲和深度缓冲 DrawGround(); DrawSky(); glColor3f(0.8, 0.8, 0.8); glPushMatrix(); //robot的位置和方向设置 glTranslatef(centerX, centerY, centerZ); glRotatef(angle, 0.0, 1.0, 0.0); glColor3f(0.5, 0.5, 0.5); //设置颜色为灰色 glPushMatrix(); //画出左大腿 glColor3f(0.5, 0.5, 0.5); glRotatef((GLfloat)leftHigherLegAngle, 0, 0, 1.0); glTranslatef(0.5*leg_x / 2, 0.0, leg_z * 0.5); glPushMatrix(); glScalef(leg_x, leg_y, leg_z); glutSolidCube(GLOBAL_SIZE); glPopMatrix(); glTranslatef(0.5 * leg_x / 2, 0.0, 0.0); //画关节 glPushMatrix(); glTranslatef(0.0, 0.0, -0.5*leg_z / 2); gluCylinder(quadratic, 0.5 * leg_y / 2, 0.5 * leg_y / 2, leg_z * 0.5, 32, 32); glPopMatrix(); glRotatef(LeftLowerLegAngle, 0.0, 0.0, 1.0); //画左小腿 glTranslatef(0.5*leg_x / 2, 0.0, 0.0); glPushMatrix(); glColor3f(0.5, 0.5, 0.5); glScalef(leg_x - 0.2, leg_y - 0.2, leg_z - 0.2); glutSolidCube(GLOBAL_SIZE); glPopMatrix(); glTranslatef(0.5*leg_x / 2, 0.0, 0.0); glRotatef(90, 0.0, 0.0, 1.0); glTranslatef(-0.5*foot_x / 2 + 0.5*foot_y / 2, 0.0, 0.0); glRotatef(leftFootAngle, 0.0, 0.0, 1.0); glPushMatrix(); glScalef(foot_x, foot_y, foot_z); glutSolidCube(GLOBAL_SIZE); glPopMatrix(); glPopMatrix(); glPushMatrix(); //画出右大腿 glColor3f(0.25, 0.45, 0.25); glRotatef((GLfloat)rightHigherLegAngle, 0, 0, 1.0); glTranslatef(leg_x / 4, 0.0, -leg_z / 2); glPushMatrix(); glScalef(leg_x, leg_y, leg_z); glutSolidCube(GLOBAL_SIZE); glPopMatrix(); glTranslatef(leg_x / 4, 0, 0); //画关节 glPushMatrix(); glTranslatef(0.0, 0.0, -leg_z / 4); gluCylinder(quadratic, leg_y / 4, leg_y / 4, leg_z / 2, 32, 32); glPopMatrix(); glRotatef(rightLowerLegAngle, 0.0, 0.0, 1.0); //画左小腿 glTranslatef(leg_x / 4, 0.0, 0.0); glPushMatrix(); glColor3f(0.5, 0.5, 0.5); glScalef(leg_x - 0.2, leg_y - 0.2, leg_z - 0.2); glutSolidCube(GLOBAL_SIZE); glPopMatrix(); glTranslatef(leg_x / 4, 0.0, 0.0); glRotatef(90, 0.0, 0.0, 1.0); glTranslatef(-foot_x / 4 + leg_y / 4, 0.0, 0.0); glRotatef(rightFootAngle, 0.0, 0.0, 1.0); glPushMatrix(); glScalef(foot_x, foot_y, foot_z); glutSolidCube(GLOBAL_SIZE); glPopMatrix(); glPopMatrix(); // 身体 glColor3f(1.0, 1.0, 1.0); glPushMatrix(); glColor3f(0.65, 0.45, 0.45); glTranslatef(0, body_y / 4, 0.0); drawCube(body_x, body_y, body_z); glPopMatrix(); glPushMatrix(); //脖子 glColor3f(0.25, 0.75, 0.75); glTranslatef(0, 0.5*body_y, 0); glScalef(neck_x, neck_y, neck_z); glutSolidCube(GLOBAL_SIZE); glPopMatrix(); // 头部 glPushMatrix(); glColor3f(0.5, 0.5, 0.5); glTranslatef(0, 0.5*body_y + 0.5*head_y, 0); drawCube_head(head_x, head_y, head_z); glPopMatrix(); glColor3f(0.5, 0.55, 0.55); glPushMatrix(); //画左手 glColor3f(0.5, 0.6, 0.6); glTranslatef(0, 0.5*body_y, 0.0); glRotatef(leftHigherHandAngle, 0.0, 0.0, 1.0); glTranslatef(arm_x / 4, 0.0, (body_z + arm_z) / 4); glPushMatrix(); glScalef(arm_x - 0.1, arm_y - 0.1, arm_z - 0.1); glutSolidCube(GLOBAL_SIZE); glPopMatrix(); glTranslatef(arm_x / 4, 0.0, 0.0); glPushMatrix(); glColor3f(0.5, 0.55, 0.55); glTranslatef(0.0, 0.0, -arm_z / 4); gluCylinder(quadratic, arm_y / 4, arm_y / 4, arm_z*0.5, 32, 32); glPopMatrix(); glRotatef(leftLowerHandAngle, 0.0, 0.0, 1.0); glTranslatef(arm_x / 4, 0.0, 0.0); glPushMatrix(); glScalef(arm_x - 0.1, arm_y - 0.1, arm_z - 0.1); glutSolidCube(GLOBAL_SIZE); glPopMatrix(); glPopMatrix(); glPushMatrix(); //画右手 glColor3f(0.5, 0.55, 0.55); glTranslatef(0, body_y / 2, 0.0); glRotatef(rightHigherHandAngle, 0.0, 0.0, 1.0); glTranslatef(arm_x / 4, 0.0, -(body_z + arm_z) / 4); glPushMatrix(); glScalef(arm_x, arm_y, arm_z); glutSolidCube(GLOBAL_SIZE); glPopMatrix(); glTranslatef(arm_x / 4, 0.0, 0.0); glPushMatrix(); glColor3f(0.5, 0.55, 0.55); glTranslatef(0.0, 0.0, -arm_z / 4); gluCylinder(quadratic, arm_y / 4, arm_y / 4, arm_z*0.5, 32, 32); glPopMatrix(); glRotatef(rightLowerHandAngle, 0.0, 0.0, 1.0); glTranslatef(arm_x / 4, 0.0, 0.0); glPushMatrix(); glScalef(arm_x - 0.1, arm_y - 0.1, arm_z - 0.1); glutSolidCube(GLOBAL_SIZE); glPopMatrix(); glPopMatrix(); glPopMatrix(); glFlush(); glutSwapBuffers(); }
void Draw (void) // Draw The Scene { Vector3d tmp3d; tmp3d=MView.Matrix() * Vector3d(0.0,100000.0,0.0) + MView.RefPos(); lightPosition[0]=(float)tmp3d(0); lightPosition[1]=(float)tmp3d(1); lightPosition[2]=(float)tmp3d(2); glLightfv(GL_LIGHT1,GL_POSITION,lightPosition); // ROACH QueryPerformanceCounter(&t3); if(InMd5Camera>=1) { Md5Cameras[InMd5Camera].Play(double(t3.QuadPart)/double(feq.QuadPart)); Md5CamerasT[InMd5Camera].Play(double(t3.QuadPart)/double(feq.QuadPart)); } //CMd5CameraTest.Play(double(t3.QuadPart)/double(feq.QuadPart)); if(domulti) glEnable(GL_MULTISAMPLE_ARB); // Enable Our Multisampling // ENDROACH glClearColor(0.0f, 0.0f, 0.0f, 0.5); // Set The Clear Color To Black glClear (GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer glLoadIdentity(); // Reset The View //MFighter.Reset(); ViewPos.UDMplane.Reset(); if(InMd5Camera>=1) { ViewPos.UDMplane.Translate(Vector3d(Md5Cameras[InMd5Camera].CameraPos[0],Md5Cameras[InMd5Camera].CameraPos[2],-Md5Cameras[InMd5Camera].CameraPos[1])); ViewPos.TurnTo(Vector3d(Md5CamerasT[InMd5Camera].CameraPos[0],Md5CamerasT[InMd5Camera].CameraPos[2],-Md5CamerasT[InMd5Camera].CameraPos[1])); } ViewPos.UDPstate.NextState(); ViewPos.UDMplane.RotateInternal(Vector3d(0.0f, CRad(180.0f), 0.0f)); /* Vector3d pos; pos = ViewPos.UDMplane.RefPos(); Vector3d dir; dir = ViewPos.UDMplane.Matrix() * Vector3d(0, 0, -1); Vector3d dir2; dir2 = ViewPos.UDMplane.Matrix() * Vector3d(1, 0, 0); double r = sqrt(pow(dir(0), 2) + pow(dir(2), 2)); if (abs(r)>1){ r = 1.0f; } double latitude = acos_s(r) * 180.0f / PI; double longitude = acos_s(dir(2) / r) * 180.0f / PI; if (dir(0) < 0){ longitude = -longitude; } double intersect[3] = {-dir(2) / r, 0, dir(0) / r}; double rotation = acos_s(dir2(0) * intersect[0] + dir2(1) * intersect[1] + dir2(2) * intersect[2]) * 180.0f / PI; if (dir2(1) < 0){ rotation = -rotation; }*/ ViewPos.UDMplane.RotateInternal(Vector3d(0.0f,0.0f ,- CRad(Getrotation(ViewPos.UDMplane)))); MFighter.RotateInternal(Vector3d(0.0f,0.0f ,- CRad(Getrotation(MFighter)))); MFighter.RotateInternal(Vector3d(CRad(Updown), 0.0f, 0.0f)); MFighter.RotateInternal(Vector3d(0.0f, -CRad(angle), 0.0f)); MFighter.TranslateInternal(Vector3d(posX,-posY,posZ)); if(InMd5Camera>=1) MFighter=ViewPos.UDMplane; MView = (MWorld * MFighter).Invert(); glLoadMatrixd(MView.Matrix4()); glDisable(GL_BLEND); glDisable(GL_ALPHA_TEST); glDisable(GL_CULL_FACE); glEnable(GL_FOG); DrawSky(MFighter); //glDisable(GL_TEXTURE_2D); //glEnable(GL_LIGHTING); //glEnable(GL_LIGHT1); glDisable(GL_BLEND); glEnable(GL_CULL_FACE); glPolygonMode(GL_FRONT_AND_BACK,_RenderMode); for(int i=0;i<ModelNumLoaded;i++) { if(i==(ModelNumLoaded-ModelAlphaNumLoaded)) { glDisable(GL_CULL_FACE); glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GEQUAL, 0.9f); //glDisable(GL_LIGHT1); //glDisable(GL_LIGHTING); } m_VBMD->ShowVBMD(pModelID[i]); } glEnable(GL_BLEND); glDepthMask(GL_FALSE); DrawGround(); glAlphaFunc(GL_LESS, 0.9f); for(int i=(ModelNumLoaded-ModelAlphaNumLoaded);i<ModelNumLoaded;i++) m_VBMD->ShowVBMD(pModelID[i]); glColor3f(1.0f,1.0f,1.0f); glDepthMask(GL_TRUE); glEnable(GL_BLEND); glDisable(GL_ALPHA_TEST); glDisable(GL_FOG); //glPushMatrix(); //glTranslated(CMd5CameraTest.CameraView[0],CMd5CameraTest.CameraView[2],-CMd5CameraTest.CameraView[1]); //m_VBMD->ShowVBMD(ballModelID); //glPopMatrix(); //DrawUI(); glDisable(GL_CULL_FACE); glDisable(GL_BLEND); DrawReadme(); if(!doangle) angle-=0.5f; glFlush (); // Flush The GL Rendering Pipeline // ROACH if(domulti) glDisable(GL_MULTISAMPLE_ARB); glColor3f(1.0f,0.5f,0.0f); DrawFPS(); glColor3f(1.0f,1.0f,1.0f); // ENDROACH }