Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

GlutRenderTools.h

Go to the documentation of this file.
00001 #ifndef __GLUTRENDERTOOLS
00002 #define __GLUTRENDERTOOLS
00003 
00004 #include "RAS_IRenderTools.h"
00005 #include "RAS_IRasterizer.h"
00006 #include <GL/glut.h>
00007 #include "StdString.h"
00008 
00009 
00010 
00011 class GlutRenderTools : public RAS_IRenderTools
00012 {
00013 
00014 public:
00015         
00016 
00017         GlutRenderTools() {
00018         
00019         };
00020         virtual ~GlutRenderTools() {
00021         
00022         };
00023         
00024         virtual void    EndFrame(RAS_IRasterizer* rasty)

00025         {
00026                         
00027         }
00028         
00029         virtual void BeginFrame(RAS_IRasterizer* rasty)

00030         {
00031                 m_modified=true;
00032                 DisableOpenGLLights();
00033         }
00034         void DisableOpenGLLights()

00035         {
00036                 glDisable(GL_LIGHTING);
00037                 glDisable(GL_COLOR_MATERIAL);
00038                 glDisableClientState(GL_NORMAL_ARRAY);
00039         }
00040         void EnableOpenGLLights()

00041         {
00042                 glEnable(GL_LIGHTING);
00043                 glColorMaterial(GL_FRONT_AND_BACK,GL_DIFFUSE);
00044                 glEnable(GL_COLOR_MATERIAL);
00045                 glEnableClientState(GL_NORMAL_ARRAY);
00046         }
00047 
00048         int             ProcessLighting(int layer) {
00049                 return false;
00050         }
00051 
00052         void    Perspective(int a,int width,int height,float mat[4][4] ,float viewmat[4][4] )

00053         {
00054                 if(a== 0) {
00055                         glMatrixMode(GL_PROJECTION);
00056                         //getmatrix(mat);//curarea->winmat);
00057                         glMatrixMode(GL_MODELVIEW);
00058                         //ortho2(-0.5, (float)(width)-.05, -0.5, (float)(height)-0.5);
00059                         glLoadIdentity();
00060                 }
00061                 else if(a== 1) {
00062                         glMatrixMode(GL_PROJECTION);
00063                         //loadmatrix(mat);//curarea->winmat);
00064                         glMatrixMode(GL_MODELVIEW);
00065                         //loadmatrix(viewmat);//G.vd->viewmat);
00066                 }
00067         }
00068 
00069         //cpack(x) ==
00070         //glColor3ub( ((x)&0xFF), (((x)>>8)&0xFF), (((x)>>16)&0xFF) )
00071 
00072         virtual void RenderText2D(const char* text,int xco,int yco)

00073         {
00074                 CCString tmpstr(text);
00075                 //BL_print_gamedebug_line(tmpstr.Ptr(),xco,yco);
00076                 int lines;
00077                 char* s = tmpstr.Ptr();
00078                 char* p;
00079 
00080                 glDisable(GL_DEPTH_TEST);
00081                 glDisable(GL_FOG);
00082                 glMatrixMode(GL_PROJECTION);
00083                 glPushMatrix();
00084                 glLoadIdentity();
00085                 glOrtho(0, glutGet((GLenum)GLUT_WINDOW_WIDTH), 
00086                         0, glutGet((GLenum)GLUT_WINDOW_HEIGHT), -1, 1);
00087                 glMatrixMode(GL_MODELVIEW);
00088                 glPushMatrix();
00089                 glLoadIdentity();
00090                 glColor3ub(255, 255, 255);
00091                 glRasterPos2i(xco, yco);
00092                 for(p = s, lines = 0; *p; p++) {
00093                 if (*p == '\n') {
00094                         lines++;
00095                         glRasterPos2i(xco, yco-(lines*18));
00096                 }
00097                 glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, *p);
00098                 }
00099                 glMatrixMode(GL_PROJECTION);
00100                 glPopMatrix();
00101                 glMatrixMode(GL_MODELVIEW);
00102                 glPopMatrix();
00103                 glEnable(GL_FOG);
00104                 glEnable(GL_DEPTH_TEST);
00105                 
00106         }
00107 
00108         virtual void    RenderText(int mode,RAS_IPolyMaterial* polymat,float v1[3],float v2[3],float v3[3],float v4[3])

00109         {
00110                 //CCString mytext = ((KX_GameObject*)m_clientobject)->GetPropertyText("Text");
00111                 //KX_BlenderPolyMaterial* blenderpoly = (KX_BlenderPolyMaterial*)polymat;
00112                 //struct TFace* tface = blenderpoly->GetTFace();
00113 //              BL_RenderText( mode,mytext,mytext.Length(),tface,v1,v2,v3,v4);
00114         }
00115         
00116 
00117         void applyTransform(RAS_IRasterizer* rasty,double* oglmatrix,int objectdrawmode )

00118         {
00119                 glPopMatrix();
00120                 glPushMatrix();
00121                 glMultMatrixd(oglmatrix);
00122         }
00123 };
00124                 
00125 #endif //__GLUTRENDERTOOLS

Generated at Thu Feb 1 13:03:02 2001 for Ketsji Game Engine by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000