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

KX_BlenderCanvas.h

Go to the documentation of this file.
00001 #ifndef __KX_BLENDERCANVAS
00002 #define __KX_BLENDERCANVAS
00003 
00004 #ifdef WIN32
00005 #include <windows.h>
00006 #endif 
00007 #include <GL/gl.h>
00008 
00009 #include "RAS_ICanvas.h"
00010 
00011 
00012 
00013 #include "KX_BlenderGL.h"
00014 
00018 
00019 class KX_BlenderCanvas : public RAS_ICanvas
00020 {
00021 public:
00022         KX_BlenderCanvas(){
00026                 int startx = int(BL_GetWindowMinX()+BL_GetWindowWidth()/2.0);
00027                 int starty = int (BL_GetWindowMinY()+BL_GetWindowHeight()/2.0);
00028                 BL_warp_pointer(startx,starty);
00029         };
00030 
00031         virtual ~KX_BlenderCanvas() {
00032 
00033         };
00034         virtual void Init() {
00035                 glDepthFunc(GL_LEQUAL);
00036         }       
00037         virtual void SwapBuffers() {
00038                 BL_SwapBuffers();
00039         };
00040         virtual void Resize(int width,int height) {
00041 
00042         };
00043         virtual void BeginFrame() {
00044                 BL_BeginFrame();
00045                 
00046                 glEnable(GL_DEPTH_TEST);
00047                 glDepthFunc(GL_LEQUAL);
00048                 
00049         };
00050         virtual void EndFrame() {
00051                 
00052                 BL_EndFrame();
00053 
00054                 /* 

00055                         this is needed, else blender distorts a lot 

00056                 */
00057                 glPopAttrib();
00058                 glPushAttrib(GL_ALL_ATTRIB_BITS);
00059                 
00060                 glDisable(GL_FOG);
00061                 //BL_DisplayCamera();
00062         };
00063         virtual void ClearColor(float r,float g,float b,float a) {
00064                 glClearColor(r,g,b,a);
00065         };
00066         virtual void ClearBuffer(int type) {
00067                 int ogltype = 0;
00068                 if (type & RAS_ICanvas::COLOR_BUFFER )
00069                         ogltype |= GL_COLOR_BUFFER_BIT;
00070                 if (type & RAS_ICanvas::DEPTH_BUFFER )
00071                         ogltype |= GL_DEPTH_BUFFER_BIT;
00072                 glClear(ogltype);
00073 
00074         };
00075 
00076         virtual int GetWidth() {
00077                 return BL_GetWindowWidth();
00078         }
00079         virtual int GetHeight() {
00080                 return BL_GetWindowHeight();
00081         }
00082 };
00083 #endif // __KX_BLENDERCANVAS

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