Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4OpenGLVboDrawer.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27//
28//
29// G4OpenGLVboDrawer : Class to provide Wt and Qt specific
30// functionality for OpenGL in GEANT4
31// All references to Wt removed - 1/3/21 JA
32
33#ifndef G4OpenGLVboDrawer_HH
34#define G4OpenGLVboDrawer_HH
35
36#include "G4OpenGL.hh"
37
38#ifdef G4OPENGL_VERSION_2
39
40// GL2PS
41#define GL2PS_TEXT_B 4
42#define GL2PS_TEXT_BL 5
43#define GL2PS_TEXT_BR 6
44#define GL2PS_EPS 1
45#define GL2PS_PDF 2
46#define GL2PS_PS 3
47#define GL2PS_SVG 4
48
49
50#define glEdgeFlag(a) fVboDrawer->empty()
51#define glRenderMode(a) fVboDrawer->returnNULL()
52#define glClipPlane(a,b) fVboDrawer->empty()
53#define glGetIntegerv(a,b) fVboDrawer->empty()
54#define glGetFloatv(a,b) fVboDrawer->empty()
55#define glGetDoublev(a,b) fVboDrawer->empty()
56#define glPassThrough fVboDrawer->empty()
57#define glGetBooleanv fVboDrawer->empty()
58#define glLoadName(a) fVboDrawer->empty()
59#define glPushMatrix() fVboDrawer->empty()
60#define glLoadIdentity() fVboDrawer->empty()
61#define glPopMatrix() fVboDrawer->empty()
62#define glCallList(a) fVboDrawer->empty()
63#define glGenLists(a) fVboDrawer->returnNULL()
64#define glVertex3d fVboDrawer->empty()
65#define glBegin fVboDrawer->empty()
66#define glEnd fVboDrawer->empty()
67#define glNewList(a,b) fVboDrawer->empty()
68#define glEndList() fVboDrawer->empty()
69#define glPolygonMode(a,b) fVboDrawer->empty()
70#define glDrawBuffer(a) fVboDrawer->empty()
71#define glDeleteLists(a,b) fVboDrawer->empty()
72#define glStencilFunc(a,b,c) fVboDrawer->empty()
73#define glStencilOp(a,b,c) fVboDrawer->empty()
74#define glColorMaterial(a,b) fVboDrawer->empty()
75#define glLightfv(a,b,c) fVboDrawer->empty()
76#define glScaled(a,b,c) fVboDrawer->empty()
77#define gluLookAt fVboDrawer->empty()
78#define gluPickMatrix fVboDrawer->empty()
79#define glSelectBuffer(a,b) fVboDrawer->empty()
80#define glInitNames() fVboDrawer->empty()
81#define glPushNames(a) fVboDrawer->empty()
82#define glPushName(a) fVboDrawer->empty()
83#define glPixelStorei(a,b) fVboDrawer->empty()
84#define glRasterPos3d(a,b,c) fVboDrawer->empty()
85#define Geant4_gl2psTextOpt(a,b,c,d,e) fVboDrawer->empty()
86#define glMaterialfv(a,b,c) fVboDrawer->empty()
87#define glCullFace(a) fVboDrawer->empty()
88#define glReadBuffer(a) fVboDrawer->empty()
89#define glReadPixels(a,b,c,d,e,f,g) fVboDrawer->empty()
90#define glTranslatef(a,b,c) fVboDrawer->empty() // TO BE FIXED
91
92// +--------------------------------+
93// + QT (OpenGL ES) case +
94// +--------------------------------+
95
97
98#define glOrtho fVboDrawer->vboGlOrtho
99#define glFrustum fVboDrawer->vboGlFrustum
100#define glMultMatrixf fVboDrawer->vboGlMultMatrixf
101#define glMultMatrixd fVboDrawer->vboGlMultMatrixd
102#define glMatrixMode fVboDrawer->vboGlMatrixMode
103#define glPointSize fVboDrawer->vboGlPointSize
104#define glColor3d fVboDrawer->vboGlColor3d
105#define glColor4d fVboDrawer->vboGlColor4d
106#define glColor4fv fVboDrawer->vboGlColor4fv
107
108
109class G4OpenGLViewer;
110
111class G4OpenGLVboDrawer {
112public:
113 G4OpenGLVboDrawer (G4OpenGLViewer*, std::string type);
114 // Create a new OpenGL Drawer. Type could be one of the following :
115 // OGL-ES, OGL-Stored, OGL-Immediate, OGL-VBO
116
117 virtual ~G4OpenGLVboDrawer ();
118
119 void vboGlMultMatrixf( const GLfloat *m );
120 void vboGlMultMatrixd( const GLdouble *m );
121
122 void vboGlFlush();
123 void vboGlOrtho(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble);
124 void vboGlFrustum(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble);
125 void vboGlMatrixMode(GLenum);
126 void vboGlPointSize(float size);
127 inline void vboGlColor3d(int red,int green,int blue) {
128 vboGlColor4d(red,green, blue, 1.0);
129 }
130 void vboGlColor4d(int red,int green,int blue,int alpha);
131 void vboGlColor4fv(const GLfloat*);
132 inline const char * getFragmentShaderSrc() {
133 return fFragmentShaderSrc;
134 }
135 inline const char * getVertexShaderSrc() {
136 return fVertexShaderSrc;
137 }
138 inline bool isVBO() {
139 if ((fOGLType == "OGL-ES") || (fOGLType == "OGL-VBO")) {
140 return true;
141 }
142 return false;
143 }
144 inline void empty() {}
145 inline GLuint returnNULL() {
146 return 0;
147 }
148
149private:
150 const char *fFragmentShaderSrc;
151 const char *fVertexShaderSrc;
152 std::string fOGLType;
153 GLenum fMatrixMode;
154
155 G4OpenGLImmediateQtViewer* fVboViewer;
156};
157
158#endif // G4OPENGL_VERSION_2
159
160#endif // G4OpenGLVboDrawer_HH
161