TGLParametricEquationGL.cxx

Go to the documentation of this file.
00001 // @(#)root/gl:$Id: TGLParametricEquationGL.cxx 36384 2010-10-20 14:26:41Z matevz $
00002 // Author:  Matevz Tadel, Jun 2007
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #include "TGLParametricEquationGL.h"
00013 
00014 #include "TGLParametric.h"
00015 #include "TVirtualPad.h"
00016 
00017 #include "TGLSurfacePainter.h"
00018 #include "TGLTF3Painter.h"
00019 
00020 #include "TGLRnrCtx.h"
00021 #include "TGLIncludes.h"
00022 
00023 //______________________________________________________________________
00024 //
00025 // GL-renderer wrapper for TGLParametricEquation.
00026 // This allows rendering of parametric-equations in standard GL viewer.
00027 
00028 ClassImp(TGLParametricEquationGL);
00029 
00030 //______________________________________________________________________________
00031 TGLParametricEquationGL::TGLParametricEquationGL() : TGLPlot3D(), fM(0)
00032 {
00033    // Constructor.
00034 }
00035 
00036 //______________________________________________________________________________
00037 TGLParametricEquationGL::~TGLParametricEquationGL()
00038 {
00039    // Destructor.
00040 }
00041 
00042 //______________________________________________________________________________
00043 Bool_t TGLParametricEquationGL::SetModel(TObject* obj, const Option_t* opt)
00044 {
00045    // Set model object.
00046 
00047    fM = SetModelDynCast<TGLParametricEquation>(obj);
00048 
00049    SetPainter( new TGLParametricPlot(fM, 0) );
00050    TString option(opt);
00051    fPlotPainter->AddOption(option);
00052    fPlotPainter->InitGeometry();
00053 
00054    return kTRUE;
00055 }
00056 
00057 //______________________________________________________________________________
00058 void TGLParametricEquationGL::SetBBox()
00059 {
00060    // Setup bounding-box.
00061 
00062    fBoundingBox.Set(fPlotPainter->RefBackBox().Get3DBox());
00063 }
00064 
00065 //______________________________________________________________________________
00066 void TGLParametricEquationGL::DirectDraw(TGLRnrCtx& /*rnrCtx*/) const
00067 {
00068    // Render the object.
00069 
00070    fPlotPainter->RefBackBox().FindFrontPoint();
00071    glPushAttrib(GL_ENABLE_BIT | GL_LIGHTING_BIT);
00072    glEnable(GL_NORMALIZE);
00073    fPlotPainter->InitGL();
00074    fPlotPainter->DrawPlot();
00075    glPopAttrib();
00076 }

Generated on Tue Jul 5 14:18:08 2011 for ROOT_528-00b_version by  doxygen 1.5.1