From: Darryl L. <py...@us...> - 2000-10-17 06:03:15
|
Update of /cvsroot/pythianproject/PythianProject/Source/GameEngine In directory slayer.i.sourceforge.net:/tmp/cvs-serv24932 Modified Files: GrEngState.pas GameGrEngState.pas Log Message: Fixed the colour issue on the text, moved some of the text code around, and changed what is displayed Index: GrEngState.pas =================================================================== RCS file: /cvsroot/pythianproject/PythianProject/Source/GameEngine/GrEngState.pas,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** GrEngState.pas 2000/10/14 19:39:16 1.7 --- GrEngState.pas 2000/10/17 06:03:12 1.8 *************** *** 10,14 **** --- 10,17 ---- FBitDepth: TBitDepth; FFilterMode: Single; + FFPS: Single; FFrames: Integer; + FtxtFont :integer; + procedure SetWindow(const Value: TOpenGLWindow); procedure SetBitDepth(const Value: TBitDepth); *************** *** 29,33 **** implementation ! uses OpenGL, SysUtils, Windows; { TGraphicsEngine } --- 32,37 ---- implementation ! uses ! glfd, OpenGL, SysUtils, Windows; { TGraphicsEngine } *************** *** 49,52 **** --- 53,67 ---- Camera.ViewWidth := OpenGLWindow.Width; Camera.ViewHeight := OpenGLWIndow.Height; + + // put code to init tests here + glfInit; + Ftxtfont := glfLoadFont(DataPath+'fonts\arial1.glf'); + glfSetAnchorPoint(GLF_LEFT_UP); + { glfSetContourColor(0, 0, 0, 0); + glfEnable(GLF_CONTOURING);} + + glfConsoleClear; + glfPrintString('Test Line 1'); + glfPrintString('Test Line 2'); end; end; *************** *** 54,58 **** procedure TGraphicsEngine.Paint; begin ! // end; --- 69,113 ---- procedure TGraphicsEngine.Paint; begin ! // Disable texturing so we can see our colours ! glDisable(GL_TEXTURE_2D); ! glColor3f(1, 1, 1); ! ! // glClear(GL_DEPTH_BUFFER_BIT); // don't know why we need this, but we do ! // well, turns out we don't :) ! ! // reinit the matrices ! glMatrixMode(GL_PROJECTION); ! glPushMatrix; ! glLoadIdentity; ! ! glMatrixMode(GL_MODELVIEW); ! glLoadIdentity; ! ! // change co-ordinate system to 1:1 pixel mapping ! glScalef(2.0 / Window.Width, -2.0 / Window.Height, 1.0); ! glTranslatef(-(Window.Width / 2), -(Window.Height / 2), 0); ! ! // need this: scale it - otherwise text will be 1x1 pixels! ! glScalef(10, 10, 1); ! ! // offset it from the top by Y/2 text rows to make it look nicer ! glTranslatef(0, 2, 0); ! ! // need this: flip matrix because GLF is expecting OpenGL default ! // co-ordinates and we have changed them. Otherwise text will be ! // upside down ! glScalef(1, -1, 1); ! ! // finally draw the text ! glfDrawSolidString(Format('FPS: %f',[FFPS])); ! ! // and restore to default ! glMatrixMode(GL_PROJECTION); ! glPopMatrix; ! ! // restore the colour to white because this affects everything else in the ! // game, and put texturing back on ! glColor3f(1, 1, 1); ! glEnable(GL_TEXTURE_2D); end; *************** *** 63,67 **** if (CurrentTime > 1000) then begin ! FWindow.AuxCaption := Format('FPS: %f',[FFrames * 1000 / (CurrentTime)]); FFrames := 0; Result := inherited Process; --- 118,123 ---- if (CurrentTime > 1000) then begin ! FFPS := FFrames * 1000 / CurrentTime; ! // FWindow.AuxCaption := Format('FPS: %f',[FFPS]); FFrames := 0; Result := inherited Process; Index: GameGrEngState.pas =================================================================== RCS file: /cvsroot/pythianproject/PythianProject/Source/GameEngine/GameGrEngState.pas,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** GameGrEngState.pas 2000/10/15 16:17:31 1.10 --- GameGrEngState.pas 2000/10/17 06:03:12 1.11 *************** *** 18,32 **** procedure SetFogStartMultiplier(const Value: Single); protected - txtFont :integer; - txtBaseList :integer; - procedure InitFog; procedure LoadSkyBox; procedure Paint; override; - - // test code - procedure InitTest; virtual; - procedure PaintTest; virtual; - procedure FinalizeTest; virtual; public procedure Finalize; override; --- 18,24 ---- *************** *** 42,46 **** uses ModelInstances, OpenGL, Points, Geometry, StdInit, TerrainEng, SysUtils, ! Trace, Windows, glfd; { TGameGrEngSate } --- 34,38 ---- uses ModelInstances, OpenGL, Points, Geometry, StdInit, TerrainEng, SysUtils, ! Trace, Windows; { TGameGrEngSate } *************** *** 52,64 **** FSkybox.Free; - FinalizeTest; - inherited; end; - procedure TGameGraphicsEngine.FinalizeTest; - begin - end; - procedure TGameGraphicsEngine.InitFog; begin --- 44,50 ---- *************** *** 111,129 **** LoadSkyBox; - InitTest; end; end; - procedure TGameGraphicsEngine.InitTest; - begin - // put code to init tests here - glfInit; - txtfont := glfLoadFont(DataPath+'fonts\arial1.glf'); - glfSetAnchorPoint(GLF_LEFT_UP); - glfConsoleClear; - glfPrintString('Test Line 1'); - glfPrintString('Test Line 2'); - end; - procedure TGameGraphicsEngine.LoadSkyBox; begin --- 97,103 ---- *************** *** 137,144 **** i: Integer; { P: TPoint3D; ! MousePt: TSingle2D;} ModelView, Projection :TMatrix4D; Viewport: TVector4i; ! x,y,z :TGLDouble; begin FSkyBox.Render(Camera.Angle); --- 111,118 ---- i: Integer; { P: TPoint3D; ! MousePt: TSingle2D; ModelView, Projection :TMatrix4D; Viewport: TVector4i; ! x,y,z: TGLDouble;} begin FSkyBox.Render(Camera.Angle); *************** *** 174,212 **** teFinishFrame; - - PaintTest; - end; ! procedure TGameGraphicsEngine.PaintTest; ! begin ! // put paint code here for tests ! ! // reinit the matrices ! glClear(GL_DEPTH_BUFFER_BIT); // don't know why we need this, but we do ! glMatrixMode(GL_MODELVIEW); ! glLoadIdentity; ! glMatrixMode(GL_PROJECTION); ! glPushMatrix; ! glLoadIdentity; ! ! glColor3f(1.0,1.0,1.0); // has no effect :( ! ! ! // change co-ordinate system to 1:1 pixel mapping ! glScalef(2.0 / Window.Width, -2.0 / Window.Height, 1.0); ! glTranslatef(-(window.width / 2), -(window.height/2), 0); ! ! // offset it from the top by 10px to make it look nicer ! glTranslatef(0,10,0); ! // need this: scale it - otherwise text will be 1x1 pixels! ! glScalef(20,20,0); ! // need this: flip matrix because GLF is expecting OpenGL default ! // co-ordinates and we have changed them. Otherwise text will be ! // upside down ! glScalef(1,-1,1); ! // finally draw the text ! glfDrawSolidString('Pythian Project 2000'); ! // and restore to default ! glPopMatrix; end; --- 148,153 ---- teFinishFrame; ! inherited; end; |