00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef GLWINDOW_H
00019 #define GLWINDOW_H
00020
00021 #include <GL/gl.h>
00022 #include <iostream>
00023 #include "glcamera.h"
00024 #include "glrenderset.h"
00025
00026 using namespace std;
00027
00033 class GLWindow
00034 {
00035 protected:
00036 GLsizei width, height;
00037 int xPos, yPos;
00038 IRCPointer<GLRenderSet> camerasAndLights;
00039
00040 inline void setRenderSet(GLRenderSet* rs)
00041 { camerasAndLights = rs; }
00042
00043 public:
00044 GLWindow(GLsizei w, GLsizei h, bool genRenderSet = true): width(w), height(h)
00045 {
00046 setPos(0,0);
00047 if(genRenderSet) camerasAndLights = new GLRenderSet(w,h);
00048 }
00049
00050 virtual ~GLWindow() {}
00051
00052 virtual void create(char* str, char** argv, int argc ) = 0;
00053
00054 inline IRCPointer<GLRenderSet> getRenderSet() { return camerasAndLights; }
00055 inline GLScene::CameraPtr getCamera() { return camerasAndLights->getActiveCamera(); }
00056
00057 inline void setSize(GLsizei w, GLsizei h) { width = w; height = h; }
00058 inline void setPos(int x, int y) { xPos = x; yPos = y; }
00059 inline void swapRenderSet(GLWindow* win)
00060 {
00061 IRCPointer<GLRenderSet> temp = camerasAndLights;
00062 camerasAndLights = win->camerasAndLights;
00063 win->camerasAndLights = temp;
00064 }
00065
00066 inline void useCamera() { camerasAndLights->useCamera(); }
00067 inline void useLights() { camerasAndLights->useLights(); }
00068 inline void displayGrids() { camerasAndLights->displayGrids(); }
00069
00071 const GLsizei getWidth() { return width; }
00072 const GLsizei getHeight() { return height; }
00073 const int getX() { return xPos; }
00074 const int getY() { return yPos; }
00075
00076 };
00077
00078 #endif