33 #ifdef G4VIS_BUILD_OPENGLWT_DRIVER
34 #ifndef G4OPENGLWTDRAWER_HH
35 #define G4OPENGLWTDRAWER_HH
37 # include <Wt/WGLWidget>
42 #define glViewport(a, b, width, height) (fWtDrawer->wglViewport(a, b, width, height))
43 #define glEnable fWtDrawer->wglEnable
44 #define glDisable fWtDrawer->wglDisable
45 #define glBlendFunc fWtDrawer->wglBlendFunc
46 #define glClear(a) (fWtDrawer->wglClear(a))
47 #define glClearColor fWtDrawer->wglClearColor
48 #define glClearDepth fWtDrawer->wglClearDepth
49 #define glDepthFunc fWtDrawer->wglDepthFunc
50 #define glDepthMask fWtDrawer->wglDepthMask
51 #define glFlush() fWtDrawer->wglFlush()
52 #define glColorMask fWtDrawer->wglColorMask
53 #define glLineWidth fWtDrawer->wglLineWidth
54 #define glUniformMatrix4 fWtDrawer->wglUniformMatrix4
55 #define glDrawArrays fWtDrawer->wglDrawArrays
56 #define glCreateBuffer fWtDrawer->wglCreateBuffer
57 #define glVertexPointer fWtDrawer->wglVertexPointer
58 #define glBindBuffer fWtDrawer->wglBindBuffer
59 #define glDeleteBuffer fWtDrawer->wglDeleteBuffer
60 #define glBufferDatafv fWtDrawer->wglBufferDatafv
61 #define glBufferDataiv fWtDrawer->wglBufferDataiv
62 #define glGetAttribLocation fWtDrawer->wglGetAttribLocation
63 #define glEnableVertexAttribArray fWtDrawer->wglEnableVertexAttribArray
64 #define glDisableVertexAttribArray fWtDrawer->wglDisableVertexAttribArray
65 #define glShaderSource fWtDrawer->wglShaderSource
66 #define glCompileShader fWtDrawer->wglCompileShader
67 #define glCreateShader fWtDrawer->wglCreateShader
68 #define glCreateProgram fWtDrawer->wglCreateProgram
69 #define glAttachShader fWtDrawer->wglAttachShader
70 #define glLinkProgram fWtDrawer->wglLinkProgram
71 #define glUseProgram fWtDrawer->wglUseProgram
72 #define glDrawElements fWtDrawer->wglDrawElements
73 #define glVertexAttribPointer fWtDrawer->wglVertexAttribPointer
74 #define glGetUniformLocation fWtDrawer->wglGetUniformLocation
75 #define glPointSize fWtDrawer->wglPointSize
76 #define glColor4d fWtDrawer->wglColor4d
77 #define glColor4fv fWtDrawer->wglColor4fv
78 #define glMultMatrixd fWtDrawer->wglMultMatrixd
79 #define glGetUniformLocation fWtDrawer->wglGetUniformLocation
80 #define glGetAttribLocation fWtDrawer->wglGetAttribLocation
82 #define glEdgeFlag(a) (printf("?"))// FIXME : Small debug message for: printf("glEdgeFlag Not implemented\n"))
83 #define glRenderMode(a) (printf("glRenderMode Not implemented\n"))
84 #define glClipPlane(a, b) (printf("glClipPane Not implemented\n"))
85 #define glGetIntegerv(a, b) (printf("glGetIntegerv Not implemented %d %d\n",a,*b))
86 #define glGetFloatv(a, b) (printf("glGetFloatv Not implemented\n"))
87 #define glGetDoublev(a,b) (printf("glDoublev Not implemented\n"))
88 #define glPassThrough(a) (printf("pathTrough Not implemented\n"))
89 #define glGetBooleanv(a,b) (printf("glGetBooleanv Not implemented\n"))
90 #define glLoadName(a) (printf("glLoadName Not implemented\n"))
91 #define glColor3d(a,b,c) (printf("glColor3d Not implemented\n"))
92 #define glMatrixMode(a) (printf("glMatrixMode Not implemented\n"))
93 #define glPushMatrix() (printf("glPushMatrix Not implemented\n"))
94 #define glLoadIdentity() (printf("glLoadIdentity Not implemented\n"))
95 #define glOrtho(a,b,c,d,e,f) (printf("glOrtho Not implemented %f %f %f %f %f %f\n",a,b,c,d,e,f))
96 #define glPopMatrix() (printf("glPopMatrix Not implemented\n"))
97 #define glCallList(a) (printf("glCallList Not implemented\n"))
98 #define glGenLists(a) (printf("glGenLists Not implemented\n"))
99 #define glGetError() (printf("glGetError Not implemented\n"))
100 #define glVertex3d(a,b,c) (printf("glVertex3d Not implemented\n"))
101 #define glBegin (printf("glBegin Not implemented\n"))
102 #define glEnd() (printf("glEnd Not implemented\n"))
103 #define glNewList(a,b) (printf("glNewList Not implemented\n"))
104 #define glEndList() (printf("glEndList Not implemented\n"))
105 #define glPolygonMode(a,b) (printf("glPolygonMode Not implemented\n"))
106 #define glDrawBuffer(a) (printf("glDrawBuffer Not implemented\n"))
107 #define glDeleteLists(a,b) (printf("glDeleteLists Not implemented\n"))
108 #define glStencilFunc(a,b,c) (printf("glStencilFunc Not implemented\n"))
109 #define glStencilOp(a,b,c) (printf("glStencilOp Not implemented\n"))
110 #define glColorMaterial(a,b) (printf("glColorMaterial Not implemented\n"))
111 #define glLightfv(a,b,c) (printf("glLightfv Not implemented %u %u %f\n",a,b,*c))
112 #define glScaled(a,b,c) (printf("glScaled Not implemented\n"))
113 #define glFrustum(a,b,c,d,e,f) (printf("glFrustum Not implemented\n"))
114 #define gluLookAt(a,b,c,d,e,f,g,h,i) (printf("gluLookAt Not implemented %f %f %f %f %f %f %f %f %f\n",a,b,c,d,e,f,g,h,i))
115 #define gluPickMatrix(a,b,c,d,e) (printf("gluPickMatrix Not implemented %f %f %f %f %d\n",a,b,c,d,*e))
116 #define glSelectBuffer(a,b) (printf("glSelectBuffer Not implemented\n"))
117 #define glInitNames() (printf("glInitNames Not implemented\n"))
118 #define glPushNames(a) (printf("glPushNames Not implemented\n"))
119 #define glPushName(a) (printf("glPushName Not implemented\n"))
120 #define glPixelStorei(a,b) (printf("glPixelStorei Not implemented\n"))
121 #define glRasterPos3d(a,b,c) (printf("glRasterPos3d Not implemented\n"))
122 #define Geant4_gl2psTextOpt(a,b,c,d,e) (printf("gl2psTextOpt Not implemented\n"))
123 #define glMaterialfv(a,b,c) (printf("glMaterialfv Not implemented\n"))
124 #define glCullFace(a) (printf("glCullFace Not implemented\n"))
125 #define glReadBuffer(a) (printf("glReadBuffer Not implemented\n"))
126 #define glReadPixels(a,b,c,d,e,f,g) (printf("glReadPixels Not implemented\n"))
128 #define GL_VIEWPORT Wt::WGLWidget::VIEWPORT
129 #define GL_RGBA Wt::WGLWidget::RGBA
130 #define GL_ONE_MINUS_SRC_ALPHA Wt::WGLWidget::ONE_MINUS_SRC_ALPHA
131 #define GL_BLEND Wt::WGLWidget::BLEND
132 #define GL_SRC_ALPHA Wt::WGLWidget::SRC_ALPHA
133 #define GL_LEQUAL Wt::WGLWidget::LEQUAL
134 #define GL_FALSE false
135 #define GL_LESS Wt::WGLWidget::LESS
136 #define GL_SELECT Wt::WGLWidget::SELECT
138 #define GL_RGB Wt::WGLWidget::RGB
139 #define GL_CURRENT_RASTER_POSITION_VALID Wt::WGLWidget::CURRENT_RASTER_POSITION_VALID
140 #define GL_ONE Wt::WGLWidget::ONE
141 #define GL_ZERO Wt::WGLWidget::ZERO
142 #define GL_COLOR_INDEX Wt::WGLWidget::COLOR_INDEX
143 #define GL_LINE_TOKEN Wt::WGLWidget::LINE_TOKEN
144 #define GL_LINE_RESET_TOKEN Wt::WGLWidget::LINE_RESET_TOKEN
145 #define GL_POLYGON_TOKEN Wt::WGLWidget::POLYGON_TOKEN
146 #define GL_FEEDBACK Wt::WGLWidget::FEEDBACK
147 #define GL_COLOR_CLEAR_VALUE Wt::WGLWidget::COLOR_CLEAR_VALUE
148 #define GL_BITMAP_TOKEN Wt::WGLWidget::BITMAP_TOKEN
149 #define GL_DRAW_PIXEL_TOKEN Wt::WGLWidget::DRAW_PIXEL_TOKEN
150 #define GL_COPY_PIXEL_TOKEN Wt::WGLWidget::COPY_PIXEL_TOKEN
151 #define GL_PASS_THROUGH_TOKEN Wt::WGLWidget::PASS_THROUGH_TOKEN
152 #define GL_3D_COLOR Wt::WGLWidget::3D_COLOR
153 #define GL_DEPTH_TEST Wt::WGLWidget::DEPTH_TEST
154 #define GL_FRONT Wt::WGLWidget::FRONT
155 #define GL_BACK Wt::WGLWidget::BACK
156 #define GL_FRONT_AND_BACK Wt::WGLWidget::FRONT_AND_BACK
157 #define GL_OUT_OF_MEMORY Wt::WGLWidget::OUT_OF_MEMORY
158 #define GL_LINE_STRIP Wt::WGLWidget::LINE_STRIP
159 #define GL_QUADS Wt::WGLWidget::QUADS
160 #define GL_LINE_LOOP Wt::WGLWidget::LINE_LOOP
161 #define GL_LINES Wt::WGLWidget::LINES
162 #define GL_POINTS Wt::WGLWidget::POINTS
163 #define GL_TRIANGLES Wt::WGLWidget::TRIANGLES
164 #define GL_TRIANGLE_STRIP Wt::WGLWidget::TRIANGLE_STRIP
165 #define GL_TRIANGLE_FAN Wt::WGLWidget::TRIANGLE_FAN
166 #define GL_FLOAT Wt::WGLWidget::FLOAT
167 #define GL_STENCIL_TEST Wt::WGLWidget::STENCIL_TEST
168 #define GL_ALWAYS Wt::WGLWidget::ALWAYS
169 #define GL_INVERT Wt::WGLWidget::INVERT
170 #define GL_COMPILE_AND_EXECUTE Wt::WGLWidget::COMPILE_AND_EXECUTE
171 #define GL_COMPILE Wt::WGLWidget::COMPILE
172 #define GL_COLOR_BUFFER_BIT Wt::WGLWidget::COLOR_BUFFER_BIT
173 #define GL_DEPTH_BUFFER_BIT Wt::WGLWidget::DEPTH_BUFFER_BIT
174 #define GL_STENCIL_BUFFER_BIT Wt::WGLWidget::STENCIL_BUFFER_BIT
175 #define GL_UNSIGNED_BYTE UNSIGNED_BYTE
176 #define GL_ARRAY_BUFFER Wt::WGLWidget::ARRAY_BUFFER
177 #define GL_ELEMENT_ARRAY_BUFFER Wt::WGLWidget::ELEMENT_ARRAY_BUFFER
178 #define GL_RENDER Wt::WGLWidget::RENDER
179 #define GL_LUMINANCE Wt::WGLWidget::LUMINANCE
180 #define GL_STATIC_DRAW Wt::WGLWidget::STATIC_DRAW
181 #define GL_FRAGMENT_SHADER Wt::WGLWidget::FRAGMENT_SHADER
182 #define GL_VERTEX_SHADER Wt::WGLWidget::VERTEX_SHADER
183 #define GL_UNSIGNED_INT Wt::WGLWidget::UNSIGNED_INT
184 #define GL_UNSIGNED_SHORT Wt::WGLWidget::UNSIGNED_SHORT
185 #define GL_CULL_FACE Wt::WGLWidget::CULL_FACE
186 #define GL_MAX_VIEWPORT_DIMS Wt::WGLWidget::MAX_VIEWPORT_DIMS
191 #define GL_PROJECTION_MATRIX 0
192 #define GL_UNPACK_SWAP_BYTES 0
193 #define GL_UNPACK_LSB_FIRST 0
194 #define GL_UNPACK_SKIP_ROWS 0
195 #define GL_UNPACK_LOW_LENGHT 0
196 #define GL_UNPACK_SKIP_PIXELS 0
197 #define GL_UNPACK_ALIGNMENT 0
198 #define GL_UNPACK_ROW_LENGTH 0
199 #define GL_PROJECTION 0
200 #define GL_MODELVIEW 0
201 #define GL_CLIP_PLANE0 Wt::WGLWidget::ZERO
202 #define GL_CLIP_PLANE1 Wt::WGLWidget::ZERO
203 #define GL_CLIP_PLANE2 Wt::WGLWidget::ZERO
204 #define GL_CLIP_PLANE3 Wt::WGLWidget::ZERO
205 #define GL_CLIP_PLANE4 Wt::WGLWidget::ZERO
206 #define GL_COLOR_MATERIAL Wt::WGLWidget::ZERO
207 #define GL_AMBIENT_AND_DIFFUSE Wt::WGLWidget::ZERO
209 #define GL_LIGHTING Wt::WGLWidget::ZERO
210 #define GL_POINT_SMOOTH Wt::WGLWidget::ZERO
211 #define GL_LINE_SMOOTH Wt::WGLWidget::ZERO
212 #define GL_POLYGON_SMOOTH Wt::WGLWidget::ZERO
213 #define GL_LIGHT0 Wt::WGLWidget::ZERO
214 #define GL_AMBIENT Wt::WGLWidget::ZERO
215 #define GL_DIFFUSE Wt::WGLWidget::ZERO
216 #define GL_POSITION Wt::WGLWidget::ZERO
218 #define GLenum Wt::WGLWidget::GLenum
220 typedef unsigned char GLboolean;
221 typedef unsigned int GLbitfield;
224 typedef short GLshort;
226 typedef unsigned char GLubyte;
227 typedef unsigned short GLushort;
228 typedef unsigned int GLuint;
230 typedef float GLfloat;
231 typedef float GLclampf;
232 typedef double GLdouble;
233 typedef double GLclampd;
236 #define GL2PS_TEXT_B 4
237 #define GL2PS_TEXT_BL 5
238 #define GL2PS_TEXT_BR 6
240 class G4OpenGLViewer;
241 class G4OpenGLImmediateWtViewer;
243 class G4OpenGLWtDrawer {
245 G4OpenGLWtDrawer (G4OpenGLViewer*);
246 virtual ~G4OpenGLWtDrawer ();
247 void wglClearColor (
double r,
double g,
double b,
double a);
248 void wglClearDepth(
double depth);
249 void wglClear(Wt::WFlags< GLenum > mask);
251 void wglViewport(
int x,
int y,
unsigned width,
unsigned height);
252 void wglEnable(GLenum cap);
253 void wglDisable(GLenum cap);
254 void wglBlendFunc (GLenum sfactor, GLenum dfactor);
255 void wglDepthFunc (GLenum func);
256 void wglDepthMask(
bool flag);
257 void wglColorMask (
bool red,
bool green,
bool blue,
bool alpha);
258 void wglLineWidth(
double width);
259 void wglUniformMatrix4(
const Wt::WGLWidget::UniformLocation &location,
const Wt::WMatrix4x4 &
mat);
260 void wglUniformMatrix4(
const Wt::WGLWidget::UniformLocation &location,
const Wt::WGLWidget::JavaScriptMatrix4x4 &
mat);
261 void wglDrawArrays(GLenum mode,
int first,
unsigned count);
262 Wt::WGLWidget::Buffer wglCreateBuffer();
263 void wglBindBuffer(GLenum
target, Wt::WGLWidget::Buffer
buffer);
264 void wglDeleteBuffer(Wt::WGLWidget::Buffer
buffer);
265 void wglBufferDatafv(GLenum
target,
const std::vector<double>::iterator begin,
const std::vector<double>::iterator end, GLenum
usage);
266 void wglBufferDataiv(GLenum
target,
const std::vector<unsigned short>::iterator begin,
const std::vector<unsigned short>::iterator end, GLenum
usage);
267 void wglDrawElements(GLenum mode,
unsigned count, GLenum type,
unsigned offset);
268 void wglVertexAttribPointer(Wt::WGLWidget::AttribLocation location,
int size, GLenum type,
bool normalized,
unsigned stride,
unsigned offset);
269 void wglPointSize(
float size);
270 void wglColor4d(
int red,
int green,
int blue,
int alpha);
271 void wglColor4fv(
const GLfloat*);
272 void wglMultMatrixd(
const GLdouble *
m );
273 void wglShaderSource(Wt::WGLWidget::Shader shader, GLsizei ,
const GLchar **src,
const GLint *);
274 void wglCompileShader(Wt::WGLWidget::Shader shader);
275 Wt::WGLWidget::Shader wglCreateShader(GLenum shader);
276 Wt::WGLWidget::Program wglCreateProgram();
277 void wglAttachShader(Wt::WGLWidget::Program program, Wt::WGLWidget::Shader shader);
278 void wglLinkProgram(Wt::WGLWidget::Program program);
279 void wglUseProgram(Wt::WGLWidget::Program program);
280 void wglEnableVertexAttribArray(Wt::WGLWidget::AttribLocation pointer);
281 void wglDisableVertexAttribArray(Wt::WGLWidget::AttribLocation pointer);
282 Wt::WGLWidget::UniformLocation wglGetUniformLocation(Wt::WGLWidget::Program programm,
const std::string &src);
283 Wt::WGLWidget::AttribLocation wglGetAttribLocation(Wt::WGLWidget::Shader shader,
const std::string &src);
286 G4OpenGLImmediateWtViewer* fWtViewer;