Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TGLParametricEquationGL.cxx
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Matevz Tadel, Jun 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
13 
14 #include "TGLParametric.h"
15 #include "TVirtualPad.h"
16 
17 #include "TGLSurfacePainter.h"
18 #include "TGLTF3Painter.h"
19 
20 #include "TGLRnrCtx.h"
21 #include "TGLIncludes.h"
22 
23 /** \class TGLParametricEquationGL
24 \ingroup opengl
25 GL-renderer wrapper for TGLParametricEquation.
26 This allows rendering of parametric-equations in standard GL viewer.
27 */
28 
29 ClassImp(TGLParametricEquationGL);
30 
31 ////////////////////////////////////////////////////////////////////////////////
32 /// Constructor.
33 
34 TGLParametricEquationGL::TGLParametricEquationGL() : TGLPlot3D(), fM(0)
35 {
36 }
37 
38 ////////////////////////////////////////////////////////////////////////////////
39 /// Destructor.
40 
41 TGLParametricEquationGL::~TGLParametricEquationGL()
42 {
43 }
44 
45 ////////////////////////////////////////////////////////////////////////////////
46 /// Set model object.
47 
48 Bool_t TGLParametricEquationGL::SetModel(TObject* obj, const Option_t* opt)
49 {
50  fM = SetModelDynCast<TGLParametricEquation>(obj);
51 
52  SetPainter( new TGLParametricPlot(fM, 0) );
53  TString option(opt);
54  fPlotPainter->AddOption(option);
55  fPlotPainter->InitGeometry();
56 
57  return kTRUE;
58 }
59 
60 ////////////////////////////////////////////////////////////////////////////////
61 /// Setup bounding-box.
62 
63 void TGLParametricEquationGL::SetBBox()
64 {
65  fBoundingBox.Set(fPlotPainter->RefBackBox().Get3DBox());
66 }
67 
68 ////////////////////////////////////////////////////////////////////////////////
69 /// Render the object.
70 
71 void TGLParametricEquationGL::DirectDraw(TGLRnrCtx& /*rnrCtx*/) const
72 {
73  fPlotPainter->RefBackBox().FindFrontPoint();
74  glPushAttrib(GL_ENABLE_BIT | GL_LIGHTING_BIT);
75  glEnable(GL_NORMALIZE);
76  fPlotPainter->InitGL();
77  fPlotPainter->DrawPlot();
78  glPopAttrib();
79 }