00001 // @(#)root/gl:$Id: TGLQuadric.cxx 20882 2007-11-19 11:31:26Z rdm $ 00002 00003 /************************************************************************* 00004 * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. * 00005 * All rights reserved. * 00006 * * 00007 * For the licensing terms see $ROOTSYS/LICENSE. * 00008 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00009 *************************************************************************/ 00010 00011 #include "TGLQuadric.h" 00012 #include "TGLIncludes.h" 00013 #include "TError.h" 00014 00015 ////////////////////////////////////////////////////////////////////////// 00016 // // 00017 // TGLOutput // 00018 // // 00019 // Wrapper class for GLU quadric shape drawing object. Lazy creation of // 00020 // internal GLU raw quadric on first call to TGLQuadric::Get() // 00021 ////////////////////////////////////////////////////////////////////////// 00022 00023 ClassImp(TGLQuadric) 00024 00025 //______________________________________________________________________________ 00026 TGLQuadric::TGLQuadric() : 00027 fQuad(0) 00028 { 00029 // Construct quadric 00030 } 00031 00032 //______________________________________________________________________________ 00033 TGLQuadric::~TGLQuadric() 00034 { 00035 // Destroy quadric 00036 if (fQuad) { 00037 gluDeleteQuadric(fQuad); 00038 } 00039 } 00040 00041 //______________________________________________________________________________ 00042 GLUquadric * TGLQuadric::Get() 00043 { 00044 // Get the internal raw GLU qaudric object. Created on first call. 00045 if (!fQuad) { 00046 fQuad = gluNewQuadric(); 00047 if (!fQuad) { 00048 Error("TGLQuadric::Get", "create failed"); 00049 } else { 00050 gluQuadricOrientation(fQuad, (GLenum)GLU_OUTSIDE); 00051 gluQuadricNormals(fQuad, (GLenum)GLU_SMOOTH); 00052 } 00053 } 00054 return fQuad; 00055 }