00001 #ifndef __GLUTCANVAS
00002 #define __GLUTCANVAS
00003
00004 #include "RAS_ICanvas.h"
00005 #include <GL/glut.h>
00006
00007
00008
00009
00010
00011
00012 class GlutCanvas : public RAS_ICanvas
00013 {
00014 private:
00015 int m_width;
00016 int m_height;
00017
00018 public:
00019 GlutCanvas(){
00020
00021 };
00022
00023 virtual ~GlutCanvas() {
00024
00025 };
00026 virtual void Init() {
00027
00028 }
00029 virtual void SwapBuffers() {
00030 glutSwapBuffers();
00031 };
00032 virtual void Resize(int width,int height) {
00033 m_width = width;
00034 m_height = height;
00035 };
00036
00037 virtual int GetWidth() {
00038 return m_width;
00039 }
00040 virtual int GetHeight() {
00041 return m_height;
00042 }
00043
00044 virtual void BeginFrame() {
00045 };
00046 virtual void EndFrame() {
00047 };
00048 virtual void ClearColor(float r,float g,float b,float a) {
00049 glClearColor(r,g,b,a);
00050 };
00051 virtual void ClearBuffer(int type) {
00052 int ogltype = 0;
00053 if (type & RAS_ICanvas::COLOR_BUFFER )
00054 ogltype |= GL_COLOR_BUFFER_BIT;
00055 if (type & RAS_ICanvas::DEPTH_BUFFER )
00056 ogltype |= GL_DEPTH_BUFFER_BIT;
00057 glClear(ogltype);
00058 };
00059
00060
00061 };
00062 #endif // __GLUTCANVAS