Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Root
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
为了安全,强烈建议开启2FA双因子认证:User Settings -> Account -> Enable two-factor authentication!!!
Show more breadcrumbs
cxwx
Root
Commits
87ca73cc
Commit
87ca73cc
authored
10 years ago
by
Timur Pocheptsov
Browse files
Options
Downloads
Patches
Plain Diff
Missing includes.
parent
49598253
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
tutorials/gl/grad2.C
+8
-8
8 additions, 8 deletions
tutorials/gl/grad2.C
tutorials/gl/gradients.C
+4
-8
4 additions, 8 deletions
tutorials/gl/gradients.C
tutorials/gl/parallelcoordtrans.C
+1
-2
1 addition, 2 deletions
tutorials/gl/parallelcoordtrans.C
with
13 additions
and
18 deletions
tutorials/gl/grad2.C
+
8
−
8
View file @
87ca73cc
...
...
@@ -23,17 +23,17 @@ void grad2()
//to avoid possible conflicts with other tutorials.
Color_t
freeIndices
[
4
]
=
{};
if
(
ROOT
::
GLTutorials
::
FindFreeCustomColorIndices
(
freeIndices
)
!=
4
)
{
Error
(
"grad2"
,
"can not allocate new custom colors"
);
::
Error
(
"grad2"
,
"can not allocate new custom colors"
);
return
;
}
//Make sure canvas supports OpenGL.
gStyle
->
SetCanvasPreferGL
(
kTRUE
);
//'Aliases' (instead of freeIndices[someIndex])
const
Color_t
customRed
=
freeIndices
[
0
],
grad1
=
freeIndices
[
1
];
const
Color_t
customGreen
=
freeIndices
[
2
],
grad2
=
freeIndices
[
3
];
//Make sure canvas supports OpenGL.
gStyle
->
SetCanvasPreferGL
(
kTRUE
);
//2. Check that we have a canvas with an OpenGL support.
TCanvas
*
const
cnv
=
new
TCanvas
(
"gradiend demo 2"
,
"gradient demo 2"
,
100
,
100
,
800
,
600
);
if
(
!
cnv
->
UseGL
())
{
...
...
@@ -63,7 +63,7 @@ void grad2()
typedef
TColorGradient
::
Point
Point
;
//Starting and ending points for a gradient fill (it's a vertical gradient):
gradFill1
->
SetStartEnd
(
Point
(
0
.,
0
.),
Point
(
0
.,
1
));
gradFill1
->
SetStartEnd
(
Point
(
0
.,
0
.),
Point
(
0
.,
1
.
));
// c) Custom semi-transparent green.
new
TColor
(
customGreen
,
0
.,
1
.,
0
.,
"green"
,
0
.
5
);
...
...
@@ -73,10 +73,10 @@ void grad2()
TLinearGradient
*
const
gradFill2
=
new
TLinearGradient
(
grad2
,
2
,
locations
,
idx2
);
//Vertical gradient fill.
gradFill2
->
SetStartEnd
(
Point
(
0
.,
0
),
Point
(
0
.,
1
.));
gradFill2
->
SetStartEnd
(
Point
(
0
.,
0
.
),
Point
(
0
.,
1
.));
TH1F
*
hist
=
new
TH1F
(
"a2"
,
"b2"
,
10
,
-
2
.,
3
.);
TH1F
*
hist2
=
new
TH1F
(
"c3"
,
"d3"
,
10
,
-
3
.,
3
.);
TH1F
*
const
hist
=
new
TH1F
(
"a2"
,
"b2"
,
10
,
-
2
.,
3
.);
TH1F
*
const
hist2
=
new
TH1F
(
"c3"
,
"d3"
,
10
,
-
3
.,
3
.);
hist
->
FillRandom
(
"landau"
,
100000
);
hist2
->
FillRandom
(
"gaus"
,
100000
);
...
...
This diff is collapsed.
Click to expand it.
tutorials/gl/gradients.C
+
4
−
8
View file @
87ca73cc
...
...
@@ -9,7 +9,6 @@
//Includes for ACLiC:
#include
"TColorGradient.h"
#include
"TCanvas.h"
#include
"TError.h"
...
...
@@ -40,7 +39,6 @@ void gradients()
gStyle
->
SetCanvasPreferGL
(
kTRUE
);
//Create a canvas to check if we have a right back-end which supports gradients:
TCanvas
*
const
c
=
new
TCanvas
(
"cpie"
,
"Gradient colours demo"
,
700
,
700
);
//Before we allocated any new colour or created any object:
if
(
!
c
->
UseGL
())
{
...
...
@@ -49,8 +47,6 @@ void gradients()
return
;
}
c
->
cd
();
//Linear gradient is defined by: 1) colors (to interpolate between them),
//2) coordinates for these colors along the gradient axis [0., 1.] (must be sorted!).
//3) Start and end points for a gradient, you specify them in some NDC rect ([0,0 - 1,1]),
...
...
@@ -69,19 +65,19 @@ void gradients()
0
.
8
,
1
.,
0
.
9
,
1
.
/*pale green*/
};
TLinearGradient
*
const
gradientFill1
=
new
TLinearGradient
(
linearFill
,
2
,
locations
,
rgbaData1
);
//45 degrees:
gradientFill1
->
SetStartEnd
(
TColorGradient
::
Point
(
0
,
0
),
TColorGradient
::
Point
(
1
,
1
));
gradientFill1
->
SetStartEnd
(
TColorGradient
::
Point
(
0
.
,
0
.
),
TColorGradient
::
Point
(
1
.
,
1
.
));
//Set as a background color in the canvas:
c
->
SetFillColor
(
linearFill
);
//Draw a text in the canvas (the object above the text will be
//semi-transparent):
TText
*
t
=
new
TText
(
0
.
05
,
0
.
7
,
"Can you see the text?"
);
TText
*
const
t
=
new
TText
(
0
.
05
,
0
.
7
,
"Can you see the text?"
);
t
->
Draw
();
//We create a nested pad on top to render a TPie in,
//this way we still have a text (below) + TPie with
//a fancy colour on top.
TPad
*
pad
=
new
TPad
(
"p"
,
"p"
,
0
.,
0
.,
1
.,
1
.);
TPad
*
const
pad
=
new
TPad
(
"p"
,
"p"
,
0
.,
0
.,
1
.,
1
.);
//TPad itself is fully transparent:
new
TColor
(
transparentFill
,
1
.,
1
.,
1
.,
"transparent_fill_color"
,
0
.);
...
...
@@ -112,7 +108,7 @@ void gradients()
Int_t
colors
[
nSlices
]
=
{
radialFill
,
radialFill
,
radialFill
,
radialFill
,
radialFill
};
TPie
*
pie
=
new
TPie
(
"pie"
,
"TPie:"
,
nSlices
,
values
,
colors
);
TPie
*
const
pie
=
new
TPie
(
"pie"
,
"TPie:"
,
nSlices
,
values
,
colors
);
//One slice is slightly shifted:
pie
->
SetEntryRadiusOffset
(
2
,
0
.
05
);
//Move labels to the center (to fit the pad's space):
...
...
This diff is collapsed.
Click to expand it.
tutorials/gl/parallelcoordtrans.C
+
1
−
2
View file @
87ca73cc
...
...
@@ -12,12 +12,11 @@
#include
"TParallelCoordVar.h"
#include
"TParallelCoord.h"
#include
"TVirtualX.h"
#include
"TNtuple.h"
#include
"TCanvas.h"
#include
"TRandom.h"
#include
"TColor.h"
#include
"
Rtypes
.h"
#include
"
TStyle
.h"
#include
"TError.h"
#include
"TList.h"
#include
"TROOT.h"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment