GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
oct-opengl.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2016-2021 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_oct_opengl_h)
27 #define octave_oct_opengl_h 1
28 
29 #include "octave-config.h"
30 
31 #if defined (HAVE_OPENGL)
32 
33 # if defined (HAVE_GL_GL_H)
34 # include <GL/gl.h>
35 # elif defined (HAVE_OPENGL_GL_H) || defined (HAVE_FRAMEWORK_OPENGL)
36 # include <OpenGL/gl.h>
37 # endif
38 
39 # if defined (HAVE_GL_GLU_H)
40 # include <GL/glu.h>
41 # elif defined (HAVE_OPENGL_GLU_H) || defined (HAVE_FRAMEWORK_OPENGL)
42 # include <OpenGL/glu.h>
43 # endif
44 
45 # if defined (HAVE_GL_GLEXT_H)
46 # include <GL/glext.h>
47 # elif defined (HAVE_OPENGL_GLEXT_H) || defined (HAVE_FRAMEWORK_OPENGL)
48 # include <OpenGL/glext.h>
49 # endif
50 
51 #endif
52 
53 namespace octave
54 {
56  {
57  public:
58 
59  opengl_functions (void) { }
60 
61  opengl_functions (const opengl_functions&) = default;
62 
64 
65  virtual ~opengl_functions (void) = default;
66 
67 #if defined (HAVE_OPENGL)
68 
69  // If OpenGL is not available, opengl_functions will be a dummy
70  // class that does nothing. This makes the implementation of
71  // other things that rely on this class slightly simpler.
72 
73  virtual void glAlphaFunc (GLenum func, GLclampf ref)
74  {
75  ::glAlphaFunc (func, ref);
76  }
77 
78  virtual void glBegin (GLenum mode)
79  {
80  ::glBegin (mode);
81  }
82 
83  virtual void glBindTexture (GLenum target, GLuint texture)
84  {
85  ::glBindTexture (target, texture);
86  }
87 
88  virtual void glBitmap (GLsizei width, GLsizei height, GLfloat xorig,
89  GLfloat yorig, GLfloat xmove, GLfloat ymove,
90  const GLubyte *bitmap)
91  {
92  ::glBitmap (width, height, xorig, yorig, xmove, ymove, bitmap);
93  }
94 
95  virtual void glBlendFunc (GLenum sfactor, GLenum dfactor)
96  {
97  ::glBlendFunc (sfactor, dfactor);
98  }
99 
100  virtual void glCallList (GLuint list)
101  {
102  ::glCallList (list);
103  }
104 
105  virtual void glClearColor (GLclampf red, GLclampf green, GLclampf blue,
106  GLclampf alpha)
107  {
108  ::glClearColor (red, green, blue, alpha);
109  }
110 
111  virtual void glClear (GLbitfield mask)
112  {
113  ::glClear (mask);
114  }
115 
116  virtual void glClipPlane (GLenum plane, const GLdouble *equation)
117  {
118  ::glClipPlane (plane, equation);
119  }
120 
121  virtual void glColor3dv (const GLdouble *v)
122  {
123  ::glColor3dv (v);
124  }
125 
126  virtual void glColor3f (GLfloat red, GLfloat green, GLfloat blue)
127  {
128  ::glColor3f (red, green, blue);
129  }
130 
131  virtual void glColor3fv (const GLfloat *v)
132  {
133  ::glColor3fv (v);
134  }
135 
136  virtual void glColor4d (GLdouble red, GLdouble green, GLdouble blue,
137  GLdouble alpha)
138  {
139  ::glColor4d (red, green, blue, alpha);
140  }
141 
142  virtual void glColor4f (GLfloat red, GLfloat green, GLfloat blue,
143  GLfloat alpha)
144  {
145  ::glColor4f (red, green, blue, alpha);
146  }
147 
148  virtual void glColor4fv (const GLfloat *v)
149  {
150  ::glColor4fv (v);
151  }
152 
153  virtual void glDeleteLists (GLuint list, GLsizei range)
154  {
155  ::glDeleteLists (list, range);
156  }
157 
158  virtual void glDeleteTextures (GLsizei n, const GLuint *textures)
159  {
160  ::glDeleteTextures (n, textures);
161  }
162 
163  virtual void glDepthFunc (GLenum func)
164  {
165  ::glDepthFunc (func);
166  }
167 
168  virtual void glDisable (GLenum cap)
169  {
170  ::glDisable (cap);
171  }
172 
173  virtual void glDrawPixels (GLsizei width, GLsizei height, GLenum format,
174  GLenum type, const GLvoid *pixels)
175  {
176  ::glDrawPixels (width, height, format, type, pixels);
177  }
178 
179  virtual void glEdgeFlag (GLboolean flag)
180  {
181  ::glEdgeFlag (flag);
182  }
183 
184  virtual void glEnable (GLenum cap)
185  {
186  ::glEnable (cap);
187  }
188 
189  virtual void glEndList (void)
190  {
191  ::glEndList ();
192  }
193 
194  virtual void glEnd (void)
195  {
196  ::glEnd ();
197  }
198 
199  virtual void glFinish (void)
200  {
201  ::glFinish ();
202  }
203 
204  virtual GLuint glGenLists (GLsizei range)
205  {
206  return ::glGenLists (range);
207  }
208 
209  virtual void glGenTextures (GLsizei n, GLuint *textures)
210  {
211  ::glGenTextures (n, textures);
212  }
213 
214  virtual void glGetBooleanv (GLenum pname, GLboolean *data)
215  {
216  ::glGetBooleanv (pname, data);
217  }
218 
219  virtual void glGetDoublev (GLenum pname, GLdouble *data)
220  {
221  ::glGetDoublev (pname, data);
222  }
223 
224  virtual GLenum glGetError (void)
225  {
226  return ::glGetError ();
227  }
228 
229  virtual void glGetFloatv (GLenum pname, GLfloat *data)
230  {
231  ::glGetFloatv (pname, data);
232  }
233 
234  virtual void glGetIntegerv (GLenum pname, GLint *data)
235  {
236  ::glGetIntegerv (pname, data);
237  }
238 
239  virtual const GLubyte * glGetString (GLenum name)
240  {
241  return ::glGetString (name);
242  }
243 
244  virtual void glHint (GLenum target, GLenum mode)
245  {
246  ::glHint (target, mode);
247  }
248 
249  virtual void glInitNames (void)
250  {
251  ::glInitNames ();
252  }
253 
254  virtual GLboolean glIsEnabled (GLenum cap)
255  {
256  return ::glIsEnabled (cap);
257  }
258 
259  virtual void glLightfv (GLenum light, GLenum pname, const GLfloat *params)
260  {
261  ::glLightfv (light, pname, params);
262  }
263 
264  virtual void glLineStipple (GLint factor, GLushort pattern)
265  {
266  ::glLineStipple (factor, pattern);
267  }
268 
269  virtual void glLineWidth (GLfloat width)
270  {
271  ::glLineWidth (width);
272  }
273 
274  virtual void glLoadIdentity (void)
275  {
276  ::glLoadIdentity ();
277  }
278 
279  virtual void glMaterialf (GLenum face, GLenum pname, GLfloat param)
280  {
281  ::glMaterialf (face, pname, param);
282  }
283 
284  virtual void glMaterialfv (GLenum face, GLenum pname, const GLfloat *params)
285  {
286  ::glMaterialfv (face, pname, params);
287  }
288 
289  virtual void glMatrixMode (GLenum mode)
290  {
291  ::glMatrixMode (mode);
292  }
293 
294  virtual void glMultMatrixd (const GLdouble *m)
295  {
296  ::glMultMatrixd (m);
297  }
298 
299  virtual void glNewList (GLuint list, GLenum mode)
300  {
301  ::glNewList (list, mode);
302  }
303 
304  virtual void glNormal3d (GLdouble nx, GLdouble ny, GLdouble nz)
305  {
306  ::glNormal3d (nx, ny, nz);
307  }
308 
309  virtual void glNormal3dv (const GLdouble *v)
310  {
311  ::glNormal3dv (v);
312  }
313 
314  virtual void glOrtho (GLdouble left, GLdouble right, GLdouble bottom,
315  GLdouble top, GLdouble near_val, GLdouble far_val)
316  {
317  ::glOrtho (left, right, bottom, top, near_val, far_val);
318  }
319 
320  virtual void glPixelStorei (GLenum pname, GLint param)
321  {
322  ::glPixelStorei (pname, param);
323  }
324 
325  virtual void glPixelZoom (GLfloat xfactor, GLfloat yfactor)
326  {
327  ::glPixelZoom (xfactor, yfactor);
328  }
329 
330  virtual void glPolygonMode (GLenum face, GLenum mode)
331  {
332  ::glPolygonMode (face, mode);
333  }
334 
335  virtual void glPolygonOffset (GLfloat factor, GLfloat units)
336  {
337  ::glPolygonOffset (factor, units);
338  }
339 
340  virtual void glPopAttrib (void)
341  {
342  ::glPopAttrib ();
343  }
344 
345  virtual void glPopMatrix (void)
346  {
347  ::glPopMatrix ();
348  }
349 
350  virtual void glPopName (void)
351  {
352  ::glPopName ();
353  }
354 
355  virtual void glPushAttrib (GLbitfield mask)
356  {
357  ::glPushAttrib (mask);
358  }
359 
360  virtual void glPushMatrix (void)
361  {
362  ::glPushMatrix ();
363  }
364 
365  virtual void glPushName (GLuint name)
366  {
367  ::glPushName (name);
368  }
369 
370  virtual void glRasterPos3d (GLdouble x, GLdouble y, GLdouble z)
371  {
372  ::glRasterPos3d (x, y, z);
373  }
374 
375  virtual void glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height,
376  GLenum format, GLenum type, GLvoid *pixels)
377  {
378  ::glReadPixels (x, y, width, height, format, type, pixels);
379  }
380 
381  virtual GLint glRenderMode (GLenum mode)
382  {
383  return ::glRenderMode (mode);
384  }
385 
386  virtual void glRotated (GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
387  {
388  ::glRotated (angle, x, y, z);
389  }
390 
391  virtual void glScaled (GLdouble x, GLdouble y, GLdouble z)
392  {
393  ::glScaled (x, y, z);
394  }
395 
396  virtual void glScalef (GLfloat x, GLfloat y, GLfloat z)
397  {
398  ::glScalef (x, y, z);
399  }
400 
401  virtual void glSelectBuffer (GLsizei size, GLuint *buffer)
402  {
403  ::glSelectBuffer (size, buffer);
404  }
405 
406  virtual void glShadeModel (GLenum mode)
407  {
408  ::glShadeModel (mode);
409  }
410 
411  virtual void glTexCoord2d (GLdouble s, GLdouble t)
412  {
413  ::glTexCoord2d (s, t);
414  }
415 
416  virtual void glTexImage2D (GLenum target, GLint level, GLint internalFormat,
417  GLsizei width, GLsizei height, GLint border,
418  GLenum format, GLenum type, const GLvoid *pixels)
419  {
420  ::glTexImage2D (target, level, internalFormat, width, height, border,
421  format, type, pixels);
422  }
423 
424  virtual void glTexParameteri (GLenum target, GLenum pname, GLint param)
425  {
426  ::glTexParameteri (target, pname, param);
427  }
428 
429  virtual void glTranslated (GLdouble x, GLdouble y, GLdouble z)
430  {
431  ::glTranslated (x, y, z);
432  }
433 
434  virtual void glTranslatef (GLfloat x, GLfloat y, GLfloat z)
435  {
436  ::glTranslatef (x, y, z);
437  }
438 
439  virtual void glVertex2d (GLdouble x, GLdouble y)
440  {
441  ::glVertex2d (x, y);
442  }
443 
444  virtual void glVertex3d (GLdouble x, GLdouble y, GLdouble z)
445  {
446  ::glVertex3d (x, y, z);
447  }
448 
449  virtual void glVertex3dv (const GLdouble *v)
450  {
451  ::glVertex3dv (v);
452  }
453 
454  virtual void glViewport (GLint x, GLint y, GLsizei width, GLsizei height)
455  {
456  ::glViewport (x, y, width, height);
457  }
458 
459 #endif
460  };
461 }
462 
463 
464 #endif
virtual void glBindTexture(GLenum target, GLuint texture)
Definition: oct-opengl.h:83
virtual void glGetDoublev(GLenum pname, GLdouble *data)
Definition: oct-opengl.h:219
virtual void glScalef(GLfloat x, GLfloat y, GLfloat z)
Definition: oct-opengl.h:396
virtual void glPolygonMode(GLenum face, GLenum mode)
Definition: oct-opengl.h:330
virtual void glMultMatrixd(const GLdouble *m)
Definition: oct-opengl.h:294
virtual void glEnd(void)
Definition: oct-opengl.h:194
virtual void glBegin(GLenum mode)
Definition: oct-opengl.h:78
virtual void glDisable(GLenum cap)
Definition: oct-opengl.h:168
virtual void glNormal3dv(const GLdouble *v)
Definition: oct-opengl.h:309
virtual void glSelectBuffer(GLsizei size, GLuint *buffer)
Definition: oct-opengl.h:401
virtual void glGenTextures(GLsizei n, GLuint *textures)
Definition: oct-opengl.h:209
virtual void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
Definition: oct-opengl.h:105
virtual void glPolygonOffset(GLfloat factor, GLfloat units)
Definition: oct-opengl.h:335
virtual void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val)
Definition: oct-opengl.h:314
virtual void glVertex2d(GLdouble x, GLdouble y)
Definition: oct-opengl.h:439
virtual void glDepthFunc(GLenum func)
Definition: oct-opengl.h:163
virtual void glPixelStorei(GLenum pname, GLint param)
Definition: oct-opengl.h:320
virtual void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap)
Definition: oct-opengl.h:88
virtual void glColor3dv(const GLdouble *v)
Definition: oct-opengl.h:121
virtual void glLineStipple(GLint factor, GLushort pattern)
Definition: oct-opengl.h:264
virtual void glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
Definition: oct-opengl.h:136
virtual void glShadeModel(GLenum mode)
Definition: oct-opengl.h:406
virtual void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
Definition: oct-opengl.h:284
virtual void glAlphaFunc(GLenum func, GLclampf ref)
Definition: oct-opengl.h:73
virtual void glBlendFunc(GLenum sfactor, GLenum dfactor)
Definition: oct-opengl.h:95
virtual void glGetIntegerv(GLenum pname, GLint *data)
Definition: oct-opengl.h:234
virtual void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
Definition: oct-opengl.h:375
virtual const GLubyte * glGetString(GLenum name)
Definition: oct-opengl.h:239
virtual GLboolean glIsEnabled(GLenum cap)
Definition: oct-opengl.h:254
virtual ~opengl_functions(void)=default
virtual void glDeleteTextures(GLsizei n, const GLuint *textures)
Definition: oct-opengl.h:158
virtual void glClipPlane(GLenum plane, const GLdouble *equation)
Definition: oct-opengl.h:116
virtual void glColor3f(GLfloat red, GLfloat green, GLfloat blue)
Definition: oct-opengl.h:126
virtual GLint glRenderMode(GLenum mode)
Definition: oct-opengl.h:381
virtual void glEdgeFlag(GLboolean flag)
Definition: oct-opengl.h:179
virtual void glPixelZoom(GLfloat xfactor, GLfloat yfactor)
Definition: oct-opengl.h:325
virtual void glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
Definition: oct-opengl.h:454
virtual void glPopMatrix(void)
Definition: oct-opengl.h:345
opengl_functions & operator=(const opengl_functions &)=default
virtual void glScaled(GLdouble x, GLdouble y, GLdouble z)
Definition: oct-opengl.h:391
virtual void glGetBooleanv(GLenum pname, GLboolean *data)
Definition: oct-opengl.h:214
virtual void glLineWidth(GLfloat width)
Definition: oct-opengl.h:269
virtual void glEnable(GLenum cap)
Definition: oct-opengl.h:184
virtual void glPushAttrib(GLbitfield mask)
Definition: oct-opengl.h:355
virtual void glInitNames(void)
Definition: oct-opengl.h:249
virtual void glVertex3d(GLdouble x, GLdouble y, GLdouble z)
Definition: oct-opengl.h:444
virtual void glDeleteLists(GLuint list, GLsizei range)
Definition: oct-opengl.h:153
virtual void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
Definition: oct-opengl.h:416
virtual void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
Definition: oct-opengl.h:173
virtual void glCallList(GLuint list)
Definition: oct-opengl.h:100
virtual GLuint glGenLists(GLsizei range)
Definition: oct-opengl.h:204
virtual void glEndList(void)
Definition: oct-opengl.h:189
virtual void glLoadIdentity(void)
Definition: oct-opengl.h:274
virtual void glNewList(GLuint list, GLenum mode)
Definition: oct-opengl.h:299
virtual void glTranslated(GLdouble x, GLdouble y, GLdouble z)
Definition: oct-opengl.h:429
virtual void glFinish(void)
Definition: oct-opengl.h:199
virtual void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
Definition: oct-opengl.h:142
virtual void glRasterPos3d(GLdouble x, GLdouble y, GLdouble z)
Definition: oct-opengl.h:370
virtual void glPopAttrib(void)
Definition: oct-opengl.h:340
virtual void glGetFloatv(GLenum pname, GLfloat *data)
Definition: oct-opengl.h:229
virtual GLenum glGetError(void)
Definition: oct-opengl.h:224
virtual void glHint(GLenum target, GLenum mode)
Definition: oct-opengl.h:244
virtual void glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
Definition: oct-opengl.h:386
virtual void glPopName(void)
Definition: oct-opengl.h:350
virtual void glMaterialf(GLenum face, GLenum pname, GLfloat param)
Definition: oct-opengl.h:279
virtual void glMatrixMode(GLenum mode)
Definition: oct-opengl.h:289
virtual void glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz)
Definition: oct-opengl.h:304
virtual void glTranslatef(GLfloat x, GLfloat y, GLfloat z)
Definition: oct-opengl.h:434
virtual void glColor3fv(const GLfloat *v)
Definition: oct-opengl.h:131
virtual void glColor4fv(const GLfloat *v)
Definition: oct-opengl.h:148
virtual void glPushMatrix(void)
Definition: oct-opengl.h:360
virtual void glTexCoord2d(GLdouble s, GLdouble t)
Definition: oct-opengl.h:411
virtual void glPushName(GLuint name)
Definition: oct-opengl.h:365
virtual void glTexParameteri(GLenum target, GLenum pname, GLint param)
Definition: oct-opengl.h:424
opengl_functions(const opengl_functions &)=default
virtual void glClear(GLbitfield mask)
Definition: oct-opengl.h:111
virtual void glVertex3dv(const GLdouble *v)
Definition: oct-opengl.h:449
virtual void glLightfv(GLenum light, GLenum pname, const GLfloat *params)
Definition: oct-opengl.h:259
QString name
F77_RET_T const F77_DBLE * x
T octave_idx_type m
Definition: mx-inlines.cc:773
octave_idx_type n
Definition: mx-inlines.cc:753
static int left
Definition: randmtzig.cc:191
size_t format(std::ostream &os, const char *fmt,...)
Definition: utils.cc:1329