Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
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
Model registry
Operate
Environments
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
1be3c2f2
Commit
1be3c2f2
authored
20 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
simpler solution to 2D primitive sorting problem
parent
7f66652b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Graphics/Draw.cpp
+7
-18
7 additions, 18 deletions
Graphics/Draw.cpp
with
7 additions
and
18 deletions
Graphics/Draw.cpp
+
7
−
18
View file @
1be3c2f2
// $Id: Draw.cpp,v 1.6
8
2004-12-29 22:
0
3:0
5
geuzaine Exp $
// $Id: Draw.cpp,v 1.6
9
2004-12-29 22:3
0
:0
9
geuzaine Exp $
//
//
// Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
// Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
//
//
...
@@ -47,12 +47,6 @@ void Draw3d(void)
...
@@ -47,12 +47,6 @@ void Draw3d(void)
glPopMatrix
();
glPopMatrix
();
}
}
double
GetClip
(){
double
maxz
=
MAX
(
fabs
(
CTX
.
min
[
2
]),
fabs
(
CTX
.
max
[
2
]));
if
(
maxz
<
CTX
.
lc
)
maxz
=
CTX
.
lc
;
return
maxz
*
CTX
.
s
[
2
]
*
CTX
.
clip_factor
;
}
void
Draw2d
(
void
)
void
Draw2d
(
void
)
{
{
glDisable
(
GL_DEPTH_TEST
);
glDisable
(
GL_DEPTH_TEST
);
...
@@ -61,19 +55,12 @@ void Draw2d(void)
...
@@ -61,19 +55,12 @@ void Draw2d(void)
glMatrixMode
(
GL_PROJECTION
);
glMatrixMode
(
GL_PROJECTION
);
glLoadIdentity
();
glLoadIdentity
();
// draw directly in screen coords. The special near and far clipping
// planes and the translation are there for GL2PS: without this,
// GL2PS has no way to know that the 2D primitives should be drawn
// "in front" of the scene. It's a hack, but it's the only way if we
// don't want special GL2PS commands to tell that some special
// primitives should be sorted in a non-standard way.
double
clip
=
GetClip
();
glOrtho
((
double
)
CTX
.
viewport
[
0
],
(
double
)
CTX
.
viewport
[
2
],
glOrtho
((
double
)
CTX
.
viewport
[
0
],
(
double
)
CTX
.
viewport
[
2
],
(
double
)
CTX
.
viewport
[
1
],
(
double
)
CTX
.
viewport
[
3
],
-
clip
,
clip
);
(
double
)
CTX
.
viewport
[
1
],
(
double
)
CTX
.
viewport
[
3
],
-
1.
,
1.
);
// hack to make the 2D primitives appear "in front" in GL2PS
glTranslated
(
0.0
,
0.0
,
CTX
.
clip_factor
?
1.
/
CTX
.
clip_factor
:
0.
);
glMatrixMode
(
GL_MODELVIEW
);
glMatrixMode
(
GL_MODELVIEW
);
glLoadIdentity
();
glLoadIdentity
();
// make sure that all the 2D stuff gets printed in front
glTranslated
(
0.0
,
0.0
,
0.9
*
clip
);
glPushMatrix
();
glPushMatrix
();
Draw_Graph2D
();
Draw_Graph2D
();
Draw_Text2D
();
Draw_Text2D
();
...
@@ -156,7 +143,9 @@ void Orthogonalize(int x, int y)
...
@@ -156,7 +143,9 @@ void Orthogonalize(int x, int y)
// Mesa on Linux; with hardware acceleration or on Windows
// Mesa on Linux; with hardware acceleration or on Windows
// everyhting seems to be fine).
// everyhting seems to be fine).
if
(
CTX
.
ortho
)
{
if
(
CTX
.
ortho
)
{
double
clip
=
GetClip
();
double
maxz
=
MAX
(
fabs
(
CTX
.
min
[
2
]),
fabs
(
CTX
.
max
[
2
]));
if
(
maxz
<
CTX
.
lc
)
maxz
=
CTX
.
lc
;
double
clip
=
maxz
*
CTX
.
s
[
2
]
*
CTX
.
clip_factor
;
glOrtho
(
CTX
.
vxmin
,
CTX
.
vxmax
,
CTX
.
vymin
,
CTX
.
vymax
,
-
clip
,
clip
);
glOrtho
(
CTX
.
vxmin
,
CTX
.
vxmax
,
CTX
.
vymin
,
CTX
.
vymax
,
-
clip
,
clip
);
glMatrixMode
(
GL_MODELVIEW
);
glMatrixMode
(
GL_MODELVIEW
);
glLoadIdentity
();
glLoadIdentity
();
...
...
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