Ajout de l'ensemble du workspace.
[GPU.git] / WCudaMSE / API_Bilat_Image_GL / INC / common / GLImages_A.h
1 #ifndef GLIMAGE_API_WINDOWS_H
2 #define GLIMAGE_API_WINDOWS_H
3
4 #ifdef _WIN32
5 #include <glew.h>
6 #else
7 #include <GL/glew.h>
8 #endif
9
10 #include "envGLImage.h"
11 #include "ImageObserver_I.h"
12 #include "Displayable_A.h"
13 #include "GLPrimitiveDrawers.h"
14 #include "Graphic2Ds.h"
15
16 #include <string>
17 using std::string;
18
19 #include <vector>
20 using std::vector;
21
22 #include "ImageMOOs_I.h"
23
24 /*----------------------------------------------------------------------*\
25 |* Declaration *|
26 \*---------------------------------------------------------------------*/
27
28 /*--------------------------------------*\
29 |* Public *|
30 \*-------------------------------------*/
31
32 class CBI_GLIMAGE GLImages_A: public Displayable_A, public KeyListener_I, public MouseListener_I, public ImageObserver_I
33 {
34
35 /*--------------------------------------*\
36 |* Constructor *|
37 \*-------------------------------------*/
38
39 public:
40
41 GLImages_A(ImageMOOs_I* ptrImageMOO, bool isAnimationEnable = true);
42
43 /*--------------------------------------*\
44 |* Destructor *|
45 \*-------------------------------------*/
46
47 public:
48
49 virtual ~GLImages_A();
50
51 /*--------------------------------------*\
52 |* Methodes *|
53 \*-------------------------------------*/
54
55 public:
56
57 virtual void init(Panel_A &panel);
58
59 virtual void reshape(Panel_A &panel, int w, int h);
60
61 virtual void display(Panel_A &panel);
62
63 virtual void release(Panel_A &panel);
64
65 virtual void onKeyPressed(const KeyEvent &event);
66
67 virtual void onMouseMoved(const MouseEvent &event);
68
69 virtual void onMousePressed(const MouseEvent &event);
70
71 virtual void onMouseReleased(const MouseEvent &event);
72
73 virtual void onMouseWheel(const MouseWheelEvent &event);
74
75 virtual void onImageUpdate();
76
77 protected:
78
79 virtual void fillPBO()=0;
80
81 virtual void drawPrimitives(Panel_A &panel);
82
83 virtual void createPBO();
84
85 virtual void createTexture();
86
87 void drawTexture();
88
89 void deleteTexture();
90
91 void drawCredits(Panel_A &panel);
92
93 private:
94
95 /**
96 * Update view from model, still need to manualy repaint the Window
97 */
98 void updateView();
99
100 void toImageSpaceCoordinate(int x, int y, int &imageX, int &imageY);
101
102 /*--------------------------------------*\
103 |* Get *|
104 \*-------------------------------------*/
105 public:
106 /**
107 * width of the frame
108 */
109 int getDxFrame();
110
111 /**
112 * height of the frame
113 */
114 int getDyFrame();
115
116 ImageMOOs_I* getImageMOO();
117
118 protected:
119
120 GLuint getPboID();
121
122 GLuint getTextureID();
123
124 /*--------------------------------------*\
125 |* Is *|
126 \*-------------------------------------*/
127
128 public:
129
130 bool isAnimationEnable() const;
131
132 /*--------------------------------------*\
133 |* Set *|
134 \*-------------------------------------*/
135
136 public:
137
138 void setAnimationEnable(bool isEnable);
139
140 /*--------------------------------------*\
141 |* Attributs *|
142 \*-------------------------------------*/
143
144 protected:
145
146 // Inputs
147 ImageMOOs_I* ptrImageMOO;
148 bool animationEnable;
149 int dxFrame;
150 int dyFrame;
151
152 // OpenGL
153 GLPrimitiveDrawers glPrimitiveDrawer;
154 Graphic2Ds graphique2D;
155 GLuint textureID;
156 GLuint pbo;
157 };
158
159 #endif