]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/Reve/GLUtilNS.h
Dealing with two different loaders for simulation and reconstruction if necessary...
[u/mrichter/AliRoot.git] / EVE / Reve / GLUtilNS.h
CommitLineData
e6626db2 1#ifndef Reve_GLUtilNS_H
2#define Reve_GLUtilNS_H
3#ifndef __CINT__
4
5#include <TGLIncludes.h>
6
7namespace GLUtilNS
8{
9
10class GL_Capability_Switch {
11 GLenum fWhat;
12 GLboolean fState;
13 bool fFlip;
14
15 void set_state(GLboolean s)
16 { if(s) glEnable(fWhat); else glDisable(fWhat); }
17
18public:
19 GL_Capability_Switch(GLenum what, GLboolean state) : fWhat(what)
20 {
21 fState = glIsEnabled(fWhat);
22 fFlip = (fState != state);
23 if(fFlip) set_state(state);
24 }
25 ~GL_Capability_Switch()
26 { if(fFlip) set_state(fState); }
27};
28
29class GL_Float_Holder
30{
31 GLenum fWhat;
32 GLfloat fState;
33 bool fFlip;
34 void (*fFoo)(GLfloat);
35
36public:
37 GL_Float_Holder(GLenum what, GLfloat state, void (*foo)(GLfloat)) :
38 fWhat(what), fFoo(foo)
39 {
40 glGetFloatv(fWhat, &fState);
41 fFlip = (fState != state);
42 if(fFlip) fFoo(state);
43 }
44 ~GL_Float_Holder()
45 { if(fFlip) fFoo(fState); }
46};
47
48}
49
50#endif
51#endif