Skip to content
Snippets Groups Projects
Commit 36b3ee7b authored by Timur Pocheptsov's avatar Timur Pocheptsov
Browse files

Utility function to draw quadstrips with a radial gradient.

parent 3817b152
No related branches found
No related tags found
No related merge requests found
......@@ -1223,6 +1223,9 @@ void DrawBoxFrontTextured(Double_t xMin, Double_t xMax, Double_t yMin,
void DrawBoxWithGradientFill(Double_t y1, Double_t y2, Double_t x1, Double_t x2,
const Double_t *rgba1, const Double_t *rgba2);
void DrawQuadStripWithRadialGradientFill(unsigned nPoints, const Double_t *inner, const Double_t *innerRGBA,
const Double_t *outer, const Double_t *outerRGBA);
#ifndef __CINT__
void DrawTrapezoidTextured(const Double_t ver[][2], Double_t zMin, Double_t zMax,
......
......@@ -3102,6 +3102,34 @@ void DrawBoxWithGradientFill(Double_t y1, Double_t y2, Double_t x1, Double_t x2,
glEnd();
}
//______________________________________________________________________________
void DrawQuadStripWithRadialGradientFill(unsigned nPoints, const Double_t *inner, const Double_t *innerRGBA,
const Double_t *outer, const Double_t *outerRGBA)
{
//TODO: is it possible to use GLdouble to avoid problems with Double_t/GLdouble if they
//are not the same type?
assert(nPoints != 0 &&
"DrawQuadStripWithRadialGradientFill, invalid number of points");
assert(inner != 0 &&
"DrawQuadStripWithRadialGradientFill, parameter 'inner' is null");
assert(innerRGBA != 0 &&
"DrawQuadStripWithRadialGradientFill, parameter 'innerRGBA' is null");
assert(outer != 0 &&
"DrawQuadStripWithRadialGradientFill, parameter 'outer' is null");
assert(outerRGBA != 0 &&
"DrawQuadStripWithRadialGradientFill, parameter 'outerRGBA' is null");
glBegin(GL_QUAD_STRIP);
for (UInt_t j = 0; j < nPoints; ++j) {
glColor4dv(innerRGBA);
glVertex2dv(inner + j * 2);
glColor4dv(outerRGBA);
glVertex2dv(outer + j * 2);
}
glEnd();
}
//______________________________________________________________________________
void DrawCylinder(TGLQuadric *quadric, Double_t xMin, Double_t xMax, Double_t yMin,
Double_t yMax, Double_t zMin, Double_t zMax)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment