#include <TridAnaglyphGLFrame.h>
Inheritance diagram for TridAnaglyphGLFrame:

Public Member Functions | |
| TridAnaglyphGLFrame (TridPage *tp, TGWindow &parent, TridControl *tc, double eyespace=1, const TridPOV &min=kTridPOV_DefaultRangeLow, const TridPOV &max=kTridPOV_DefaultRangeHigh) | |
| virtual | ~TridAnaglyphGLFrame () |
| virtual void | Update () |
| virtual void | TransformToPOV () |
| virtual void | SetupProjection () |
| virtual void | SetEyespace (double eyespace) |
Protected Attributes | |
| double | fEyeSpace |
| Int_t | fWhichEye |
|
||||||||||||||||||||||||||||
|
Definition at line 21 of file TridAnaglyphGLFrame.cxx. References fEyeSpace, max, min, TridGLFrame::SetupOpenGL(), and tc. 00026 : TridGLFrame( tp, parent, tc, min, max ) 00027 { 00028 // 00029 // 'scale' is the way to scale OpenGL units to window size. This is a course control, 00030 // overridden by the user. 00031 // 00032 // Min/max x/y are not limits for drawing, but rather limits to how far the POV center can be moved. 00033 // These should compare roughly with the drawable area. 00034 // 00035 // 00036 fEyeSpace = eyespace; 00037 00038 // Do my own setup. 00039 SetupOpenGL(); 00040 00041 cout << "TridAnaglyphGLFrame constructor." << endl; 00042 }
|
|
|
Definition at line 45 of file TridAnaglyphGLFrame.cxx. 00046 {
00047 cout << "TridAnaglyphGLFrame destructor." << endl;
00048 }
|
|
|
Reimplemented from TridGLFrame. Definition at line 35 of file TridAnaglyphGLFrame.h. References fEyeSpace, Particle::Sign(), and Update(). 00035 { fEyeSpace = TMath::Sign(eyespace,fEyeSpace); Update(); };
|
|
|
Reimplemented from TridGLFrame. Definition at line 97 of file TridAnaglyphGLFrame.cxx. 00098 {
00099 // Adjust perspective for the true width.
00100 gluPerspective(30.0f,(GLfloat)fDrawContext->fWidth/(GLfloat)fDrawContext->fHeight,0.1f,100.0f);
00101 }
|
|
|
Reimplemented from TridGLFrame. Definition at line 105 of file TridAnaglyphGLFrame.cxx. References fEyeSpace, fWhichEye, TridPOV::GetDist(), TridPOV::GetPhi(), TridPOV::GetTheta(), TridPOV::GetX(), TridPOV::GetY(), TridPOV::GetZ(), and TridGLFrame::NormalizeAndClipPOV(). Referenced by Update(). 00106 {
00107 // Clip the POV so it conforms to limits.
00108 NormalizeAndClipPOV();
00109
00110 // Need to manipulate the ModelView matrix to move our model around.
00111 glMatrixMode(GL_MODELVIEW);
00112
00113 // Reset to 0,0,0; no rotation, no scaling.
00114 glLoadIdentity();
00115
00116 // Pull back so we can look at it.
00117 glTranslatef(0.0f,0.0f,-fPOV.GetDist());
00118
00119 // Add eyespace
00120 if(fWhichEye==0)
00121 glTranslatef(-fEyeSpace*0.5, 0.0f,0.0f);
00122 else
00123 glTranslatef( fEyeSpace*0.5, 0.0f,0.0f);
00124
00125
00126 // Rotate to our view.
00127 glRotatef(fPOV.GetTheta(),1.0f,0.0f,0.0f); // Rotate to elevation.
00128 if(fPOV.GetPhi()!=0)
00129 glRotatef(fPOV.GetPhi() ,0.0f,1.0f,0.0f); // Rotate to side
00130
00131 // Move to our viewpoint.
00132 glTranslatef(-fPOV.GetX(), -fPOV.GetY(), -fPOV.GetZ()); // Move to our viewpoint.
00133
00134 TVector3 rightdir(-1,0,0); // If no rotation, right is -x
00135 rightdir.Rotate(-fPOV.GetPhi()*TMath::Pi()/180., // phi in radians.
00136 TVector3(0,1,0)); // Rotate about y axis
00137
00138 // rightdir *= fEyeSpace*0.5;
00139 // if(fWhichEye==0)
00140 // glTranslatef( rightdir.x(),rightdir.y(),rightdir.z() );
00141 // else
00142 // glTranslatef(-rightdir.x(),-rightdir.y(),-rightdir.z());
00143
00144 }
|
|
|
Reimplemented from TridGLFrame. Definition at line 52 of file TridAnaglyphGLFrame.cxx. References TridGLFrame::ClearViewport(), TridGLFrame::DrawHUD(), TridGLFrame::DrawObjects(), fWhichEye, TridGLFrame::SetupLighting(), TridGLFrame::SetupOptions(), TridGLFrame::SwapBuffers(), and TransformToPOV(). Referenced by SetEyespace(). 00053 {
00054 // Clears and redraws the OpenGL viewport.
00055 struct timeval timestart,timeend;
00056 gettimeofday(×tart,0);
00057
00058 // Unsure that our window is the current one for OpenGL.
00059 // (This call must be atomic!)
00060 glXMakeCurrent(fDrawContext->fDisplay, fDrawContext->fWindow, fDrawContext->fglxContext);
00061 glViewport(0,0,fWidth,fHeight);
00062 ClearViewport(); // Wipe blank. (Could be later, but we are double-buffering.)
00063
00064 glEnable(GL_BLEND);
00065 glBlendFunc(GL_ONE,GL_ONE);
00066
00067 fWhichEye = 0;
00068 glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_TRUE); // filter out red (blue eye)
00069 TransformToPOV(); // Set the cmera in world coordinates
00070 SetupOptions(); // Change OpenGL options
00071 SetupLighting(); // Put in light sources
00072 DrawObjects(); // Draw the Sketches
00073 DrawHUD(); // Put on the overlay.
00074
00075 glClear(GL_DEPTH_BUFFER_BIT);
00076 glEnable(GL_BLEND);
00077 glBlendFunc(GL_ONE,GL_ONE);
00078
00079 fWhichEye = 1;
00080 glColorMask(GL_FALSE, GL_FALSE, GL_TRUE, GL_TRUE); // filter out blue (red eye)
00081 TransformToPOV(); // Set the cmera in world coordinates
00082 SetupOptions(); // Change OpenGL options
00083 SetupLighting(); // Put in light sources
00084 DrawObjects(); // Draw the Sketches
00085 DrawHUD(); // Put on the overlay.
00086
00087 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); // filter out nothing
00088
00089 glFlush(); // Send commands to X server
00090 SwapBuffers();
00091 gettimeofday(&timeend,0);
00092
00093 fFrameTime = (timeend.tv_sec - timestart.tv_sec) +
00094 (timeend.tv_usec - timestart.tv_usec) * 0.000001;
00095 }
|
|
|
Definition at line 38 of file TridAnaglyphGLFrame.h. Referenced by SetEyespace(), TransformToPOV(), and TridAnaglyphGLFrame(). |
|
|
Definition at line 39 of file TridAnaglyphGLFrame.h. Referenced by TransformToPOV(), and Update(). |
1.3.9.1