ROOT logo
ROOT » GRAF3D » GL » TGLUtil

class TGLUtil


 Wrapper class for various misc static functions - error checking,
 draw helpers etc.

Function Members (Methods)

public:
virtual~TGLUtil()
static voidBeginAttLine(const TAttLine& aline, Char_t transp, Int_t pick_radius = 0, Bool_t selection = kFALSE)
static voidBeginExtendPickRegion(Float_t scale)
static Int_tCheckError(const char* loc)
static TClass*Class()
static voidColor(const TGLColor& color)
static voidColor3f(Float_t r, Float_t g, Float_t b)
static voidColor3fv(const Float_t* rgb)
static voidColor3ub(UChar_t r, UChar_t g, UChar_t b)
static voidColor3ubv(const UChar_t* rgb)
static voidColor4f(Float_t r, Float_t g, Float_t b, Float_t a)
static voidColor4fv(const Float_t* rgba)
static voidColor4ub(UChar_t r, UChar_t g, UChar_t b, UChar_t a)
static voidColor4ubv(const UChar_t* rgba)
static voidColorAlpha(const TGLColor& color, UChar_t alpha)
static voidColorAlpha(const TGLColor& color, Float_t alpha)
static voidColorAlpha(Color_t color_index, Float_t alpha = 1)
static voidColorTransparency(Color_t color_index, Char_t transparency = 0)
static voidDrawLine(const TGLLine3& line, TGLUtil::ELineHeadShape head, Double_t size, const UChar_t* rgba)
static voidDrawLine(const TGLVertex3& start, const TGLVector3& vector, TGLUtil::ELineHeadShape head, Double_t size, const UChar_t* rgba)
static voidDrawNumber(const TString& num, const TGLVertex3& pos, Bool_t center = kFALSE)
static voidDrawReferenceMarker(const TGLCamera& camera, const TGLVertex3& pos, Float_t radius = 3, const UChar_t* rgba = 0)
static voidDrawRing(const TGLVertex3& center, const TGLVector3& normal, Double_t radius, const UChar_t* rgba)
static voidDrawSimpleAxes(const TGLCamera& camera, const TGLBoundingBox& bbox, Int_t axesType)
static voidDrawSphere(const TGLVertex3& position, Double_t radius, const UChar_t* rgba)
static voidEndAttLine(Int_t pick_radius = 0, Bool_t selection = kFALSE)
static voidEndExtendPickRegion()
static UInt_tGetDefaultDrawQuality()
static UInt_tGetDrawQuality()
static GLUtesselator*GetDrawTesselator3dv()
static GLUtesselator*GetDrawTesselator3fv()
static GLUtesselator*GetDrawTesselator4dv()
static GLUtesselator*GetDrawTesselator4fv()
static Float_tGetLineWidthScale()
static Int_tGetPickingRadius()
static Float_tGetPointLineScalingFactor()
static Float_tGetPointSizeScale()
static Float_tGetScreenScalingFactor()
static voidInitializeIfNeeded()
virtual TClass*IsA() const
static Bool_tIsColorLocked()
static Float_tLineWidth()
static voidLineWidth(Float_t line_width)
static UInt_tLockColor()
static Float_tPointSize()
static voidPointSize(Float_t point_size)
static voidPointToViewport(Int_t& x, Int_t& y)
static voidPointToViewport(Int_t& x, Int_t& y, Int_t& w, Int_t& h)
static voidRenderCrosses(const TAttMarker& marker, Float_t* p, Int_t n, Bool_t sec_selection = kFALSE)
static voidRenderCrosses(const TAttMarker& marker, const vector<Double_t>& points, Double_t dX, Double_t dY, Double_t dZ)
static voidRenderPoints(const TAttMarker& marker, const vector<Double_t>& points)
static voidRenderPoints(const TAttMarker& marker, Float_t* p, Int_t n, Int_t pick_radius = 0, Bool_t selection = kFALSE, Bool_t sec_selection = kFALSE)
static voidRenderPolyLine(const TAttLine& aline, Char_t transp, Float_t* p, Int_t n, Int_t pick_radius = 0, Bool_t selection = kFALSE)
static voidRenderPolyMarkers(const TAttMarker& marker, const vector<Double_t>& points, Double_t dX, Double_t dY, Double_t dZ)
static voidRenderPolyMarkers(const TAttMarker& marker, Char_t transp, Float_t* p, Int_t n, Int_t pick_radius = 0, Bool_t selection = kFALSE, Bool_t sec_selection = kFALSE)
static voidResetDrawQuality()
static voidSetDefaultDrawQuality(UInt_t dq)
static voidSetDrawColors(const UChar_t* rgba)
static voidSetDrawQuality(UInt_t dq)
static voidSetLineWidthScale(Float_t scale)
static voidSetPointSizeScale(Float_t scale)
virtual voidShowMembers(TMemberInspector&)
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
static UInt_tUnlockColor()
private:
TGLUtil(const TGLUtil&)
TGLUtil&operator=(const TGLUtil&)

Data Members

public:
enum ELineHeadShape { kLineHeadNone
kLineHeadArrow
kLineHeadBox
};
enum EAxesType { kAxesNone
kAxesEdge
kAxesOrigin
};
public:
static const UChar_tfgBlue[4]
static const UChar_tfgGreen[4]
static const UChar_tfgGrey[4]
static const UChar_tfgRed[4]
static const UChar_tfgWhite[4]
static const UChar_tfgYellow[4]
private:
static UInt_tfgColorLockCount
static UInt_tfgDefaultDrawQuality
static UInt_tfgDrawQuality
static Float_tfgLineWidth
static Float_tfgLineWidthScale
static Int_tfgPickingRadius
static Float_tfgPointLineScalingFactor
static Float_tfgPointSize
static Float_tfgPointSizeScale
static Float_tfgScreenScalingFactor

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

GLUtesselator* GetDrawTesselator3fv()
 Returns a tesselator for direct drawing when using 3-vertices with
 single precision.
GLUtesselator* GetDrawTesselator4fv()
 Returns a tesselator for direct drawing when using 4-vertices with
 single precision.
GLUtesselator* GetDrawTesselator3dv()
 Returns a tesselator for direct drawing when using 3-vertices with
 double precision.
GLUtesselator* GetDrawTesselator4dv()
 Returns a tesselator for direct drawing when using 4-vertices with
 double precision.
void InitializeIfNeeded()
 Initialize globals that require other libraries to be initialized.
 This is called from TGLWidget creation function.
UInt_t GetDrawQuality()
static: get draw quality
void SetDrawQuality(UInt_t dq)
static: set draw quality
void ResetDrawQuality()
static: reset draw quality
UInt_t GetDefaultDrawQuality()
static: get default draw quality
void SetDefaultDrawQuality(UInt_t dq)
static: set default draw quality
Int_t CheckError(const char* loc)
 Check current GL error state, outputing details via ROOT
 Error method if one
UInt_t LockColor()
 Prevent further color changes.
UInt_t UnlockColor()
 Allow color changes.
Bool_t IsColorLocked()
 Returns true if color lockcount is greater than 0.
void Color(const TGLColor& color)
 Set color from TGLColor.
void ColorAlpha(const TGLColor& color, UChar_t alpha)
 Set color from TGLColor and alpha value.
void ColorAlpha(const TGLColor& color, Float_t alpha)
 Set color from TGLColor and alpha value.
void ColorAlpha(Color_t color_index, Float_t alpha = 1)
 Set color from color_index and GL-style alpha (default 1).
void ColorTransparency(Color_t color_index, Char_t transparency = 0)
 Set color from color_index and ROOT-style transparency (default 0).
void Color3ub(UChar_t r, UChar_t g, UChar_t b)
 Wrapper for glColor3ub.
void Color4ub(UChar_t r, UChar_t g, UChar_t b, UChar_t a)
 Wrapper for glColor4ub.
void Color3ubv(const UChar_t* rgb)
 Wrapper for glColor3ubv.
void Color4ubv(const UChar_t* rgba)
 Wrapper for glColor4ubv.
void Color3f(Float_t r, Float_t g, Float_t b)
 Wrapper for glColor3f.
void Color4f(Float_t r, Float_t g, Float_t b, Float_t a)
 Wrapper for glColor4f.
void Color3fv(const Float_t* rgb)
 Wrapper for glColor3fv.
void Color4fv(const Float_t* rgba)
 Wrapper for glColor4fv.
void PointToViewport(Int_t& x, Int_t& y)
 Convert from point/screen coordinates to GL viewport coordinates.
void PointToViewport(Int_t& x, Int_t& y, Int_t& w, Int_t& h)
 Convert from point/screen coordinates to GL viewport coordinates.
Float_t GetScreenScalingFactor()
 Returns scaling factor between screen points and GL viewport pixels.
 This is what is returned by gVirtualX->GetOpenGLScalingFactor() but is
 cached here to avoid a virtual function call as it is used quite often in
 TGLPhysical shape when drawing the selection highlight.
Float_t GetPointLineScalingFactor()
 Return extra scaling factor for points and lines.
 By default this is set to the same value as ScreenScalingFactor to keep
 the same appearance. To override use rootrc entry, e.g.:
 OpenGL.PointLineScalingFactor: 1.0
Int_t GetPickingRadius()
 Returns picking radius.
Float_t GetPointSizeScale()
 Get global point-size scale.
void SetPointSizeScale(Float_t scale)
 Set global point-size scale.
Float_t GetLineWidthScale()
 Returns global line-width scale.
void SetLineWidthScale(Float_t scale)
 Set global line-width scale.
void PointSize(Float_t point_size)
 Set the point-size, taking the global scaling into account.
 Wrapper for glPointSize.
void LineWidth(Float_t line_width)
 Set the line-width, taking the global scaling into account.
 Wrapper for glLineWidth.
Float_t PointSize()
 Get the point-size, taking the global scaling into account.
Float_t LineWidth()
 Get the line-width, taking the global scaling into account.
void BeginExtendPickRegion(Float_t scale)
 Extend pick region for large point-sizes or line-widths.
void EndExtendPickRegion()
 End extension of the pick region.
void RenderPolyMarkers(const TAttMarker& marker, Char_t transp, Float_t* p, Int_t n, Int_t pick_radius = 0, Bool_t selection = kFALSE, Bool_t sec_selection = kFALSE)
 Render polymarkers at points specified by p-array.
 Supports point and cross-like styles.
void RenderPolyMarkers(const TAttMarker& marker, const vector<Double_t>& points, Double_t dX, Double_t dY, Double_t dZ)
 Render polymarkers at points specified by p-array.
 Supports point and cross-like styles.
 Color is set externally. Lighting is disabled externally.
void RenderPoints(const TAttMarker& marker, Float_t* p, Int_t n, Int_t pick_radius = 0, Bool_t selection = kFALSE, Bool_t sec_selection = kFALSE)
 Render markers as circular or square points.
 Color is never changed.
void RenderPoints(const TAttMarker& marker, const vector<Double_t>& points)
 Render markers as circular or square points.
 Color is never changed.
void RenderCrosses(const TAttMarker& marker, Float_t* p, Int_t n, Bool_t sec_selection = kFALSE)
 Render markers as crosses.
 Color is never changed.
void RenderCrosses(const TAttMarker& marker, const vector<Double_t>& points, Double_t dX, Double_t dY, Double_t dZ)
 Render markers as crosses.
 Color is never changed.
void RenderPolyLine(const TAttLine& aline, Char_t transp, Float_t* p, Int_t n, Int_t pick_radius = 0, Bool_t selection = kFALSE)
 Render poly-line as specified by the p-array.
void BeginAttLine(const TAttLine& aline, Char_t transp, Int_t pick_radius = 0, Bool_t selection = kFALSE)
 Setup drawing parrameters according to passed TAttLine.
void EndAttLine(Int_t pick_radius = 0, Bool_t selection = kFALSE)
 Restore previous line drawing state.
void SetDrawColors(const UChar_t* rgba)
 Set basic draw colors from 4 component 'rgba'
 Used by other TGLUtil drawing routines

 Sets basic (unlit) color - glColor
 and also GL materials (see OpenGL docs) thus:

 diffuse  : rgba
 ambient  : 0.0 0.0 0.0 1.0
 specular : 0.6 0.6 0.6 1.0
 emission : rgba/4.0
 shininess: 60.0

 emission is set so objects with no lights (but lighting still enabled)
 are partially visible
void DrawSphere(const TGLVertex3& position, Double_t radius, const UChar_t* rgba)
 Draw sphere, centered on vertex 'position', with radius 'radius',
 color 'rgba'
void DrawLine(const TGLLine3& line, TGLUtil::ELineHeadShape head, Double_t size, const UChar_t* rgba)
 Draw thick line (tube) defined by 'line', with head at end shape
 'head' - box/arrow/none, (head) size 'size', color 'rgba'
void DrawLine(const TGLVertex3& start, const TGLVector3& vector, TGLUtil::ELineHeadShape head, Double_t size, const UChar_t* rgba)
 Draw thick line (tube) running from 'start', length 'vector',
 with head at end of shape 'head' - box/arrow/none,
 (head) size 'size', color 'rgba'
void DrawRing(const TGLVertex3& center, const TGLVector3& normal, Double_t radius, const UChar_t* rgba)
 Draw ring, centered on 'center', lying on plane defined by 'center' & 'normal'
 of outer radius 'radius', color 'rgba'
void DrawReferenceMarker(const TGLCamera& camera, const TGLVertex3& pos, Float_t radius = 3, const UChar_t* rgba = 0)
 Draw a sphere- marker on world-coordinate 'pos' with pixel
 radius 'radius'. Color argument is optional.
void DrawSimpleAxes(const TGLCamera& camera, const TGLBoundingBox& bbox, Int_t axesType)
 Draw simple xyz-axes for given bounding-box.
void DrawNumber(const TString& num, const TGLVertex3& pos, Bool_t center = kFALSE)
 Draw number in string 'num' via internal 8x8-pixel bitmap on
 vertex 'pos'. If 'center' is true, the number is centered on 'pos'.
 Only numbers, '.', '-' and ' ' are supported.
TGLColor& operator=(const TGLUtil& )
TGLUtil(const TGLUtil& )
virtual ~TGLUtil()
{}