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
8eb1e514
Commit
8eb1e514
authored
19 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
fixes for windows/cygwin (cannot use glVertex2d when there is a transfo along z)
parent
d654aa8f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Graphics/Draw.cpp
+23
-23
23 additions, 23 deletions
Graphics/Draw.cpp
with
23 additions
and
23 deletions
Graphics/Draw.cpp
+
23
−
23
View file @
8eb1e514
// $Id: Draw.cpp,v 1.8
6
2005-12-1
8 23:45:01
geuzaine Exp $
// $Id: Draw.cpp,v 1.8
7
2005-12-1
9 02:24:56
geuzaine Exp $
//
//
// Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
// Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
//
//
...
@@ -176,24 +176,24 @@ void InitProjection(int x, int y)
...
@@ -176,24 +176,24 @@ void InitProjection(int x, int y)
// we should generalize the following for cases when the object is
// we should generalize the following for cases when the object is
// located far from the z=0 plane
// located far from the z=0 plane
double
grad
ient_zdist
,
gradient_xyfact
;
double
grad
_z
,
grad_xy
;
if
(
CTX
.
ortho
)
{
if
(
CTX
.
ortho
)
{
// setting up the near and far clipping planes so that the box is
// setting up the near and far clipping planes so that the box is
// large enough to manipulate the model and zoom, but not too big
// large enough to manipulate the model and zoom, but not too big
// (the z-buffer resolution, e.g., on software Mesa can become
// (the z-buffer resolution, e.g., on software Mesa can become
// insufficient)
// insufficient)
double
max
z
=
MAX
(
fabs
(
CTX
.
min
[
2
]),
fabs
(
CTX
.
max
[
2
]));
double
z
max
=
MAX
(
fabs
(
CTX
.
min
[
2
]),
fabs
(
CTX
.
max
[
2
]));
if
(
max
z
<
CTX
.
lc
)
max
z
=
CTX
.
lc
;
if
(
z
max
<
CTX
.
lc
)
z
max
=
CTX
.
lc
;
double
clip
=
max
z
*
CTX
.
s
[
2
]
*
CTX
.
clip_factor
;
double
clip
=
z
max
*
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
();
grad
ient_zdist
=
0.99
*
clip
;
grad
_z
=
0.99
*
clip
;
grad
ient_xyfact
=
1.
;
grad
_xy
=
1.
;
}
}
else
{
else
{
double
near
=
0.75
*
CTX
.
clip_factor
*
CTX
.
lc
;
double
z
near
=
0.75
*
CTX
.
clip_factor
*
CTX
.
lc
;
double
far
=
75.
*
CTX
.
clip_factor
*
CTX
.
lc
;
double
z
far
=
75.
*
CTX
.
clip_factor
*
CTX
.
lc
;
// recenter the model such that the perspective is always at the
// recenter the model such that the perspective is always at the
// center of gravity (we should maybe add an option to choose
// center of gravity (we should maybe add an option to choose
// this, as we do for the rotation center)
// this, as we do for the rotation center)
...
@@ -203,37 +203,36 @@ void InitProjection(int x, int y)
...
@@ -203,37 +203,36 @@ void InitProjection(int x, int y)
CTX
.
vxmax
-=
CTX
.
t_init
[
0
];
CTX
.
vxmax
-=
CTX
.
t_init
[
0
];
CTX
.
vymin
-=
CTX
.
t_init
[
1
];
CTX
.
vymin
-=
CTX
.
t_init
[
1
];
CTX
.
vymax
-=
CTX
.
t_init
[
1
];
CTX
.
vymax
-=
CTX
.
t_init
[
1
];
glFrustum
(
CTX
.
vxmin
,
CTX
.
vxmax
,
CTX
.
vymin
,
CTX
.
vymax
,
near
,
far
);
glFrustum
(
CTX
.
vxmin
,
CTX
.
vxmax
,
CTX
.
vymin
,
CTX
.
vymax
,
z
near
,
z
far
);
glMatrixMode
(
GL_MODELVIEW
);
glMatrixMode
(
GL_MODELVIEW
);
glLoadIdentity
();
glLoadIdentity
();
glTranslated
(
-
10
*
CTX
.
t_init
[
0
],
-
10
*
CTX
.
t_init
[
1
],
-
10
*
near
);
glTranslated
(
-
10
*
CTX
.
t_init
[
0
],
-
10
*
CTX
.
t_init
[
1
],
-
10
*
z
near
);
glScaled
(
10.
,
10.
,
10.
);
glScaled
(
10.
,
10.
,
10.
);
grad
ient_zdist
=
0.99
*
far
;
grad
_z
=
0.99
*
z
far
;
grad
ient_xyfact
=
far
/
near
;
grad
_xy
=
z
far
/
z
near
;
}
}
// draw background gradient
// draw background gradient
if
(
CTX
.
render_mode
!=
GMSH_SELECT
&&
CTX
.
bg_gradient
){
if
(
CTX
.
render_mode
!=
GMSH_SELECT
&&
CTX
.
bg_gradient
){
glPushMatrix
();
glPushMatrix
();
glLoadIdentity
();
glLoadIdentity
();
glTranslated
(
0.
,
0.
,
-
gradient_zdist
);
glTranslated
(
0.
,
0.
,
-
grad_z
);
glShadeModel
(
GL_SMOOTH
);
glBegin
(
GL_QUADS
);
glBegin
(
GL_QUADS
);
if
(
CTX
.
bg_gradient
==
1
){
if
(
CTX
.
bg_gradient
==
1
){
glColor4ubv
((
GLubyte
*
)
&
CTX
.
color
.
bg
);
glColor4ubv
((
GLubyte
*
)
&
CTX
.
color
.
bg
);
glVertex
2
d
(
grad
ient_xyfact
*
CTX
.
vxmin
,
grad
ient_xyfact
*
CTX
.
vymin
);
glVertex
3
d
(
grad
_xy
*
CTX
.
vxmin
,
grad
_xy
*
CTX
.
vymin
,
0.
);
glVertex
2
d
(
grad
ient_xyfact
*
CTX
.
vxmax
,
grad
ient_xyfact
*
CTX
.
vymin
);
glVertex
3
d
(
grad
_xy
*
CTX
.
vxmax
,
grad
_xy
*
CTX
.
vymin
,
0.
);
glColor4ubv
((
GLubyte
*
)
&
CTX
.
color
.
bg_grad
);
glColor4ubv
((
GLubyte
*
)
&
CTX
.
color
.
bg_grad
);
glVertex
2
d
(
grad
ient_xyfact
*
CTX
.
vxmax
,
grad
ient_xyfact
*
CTX
.
vymax
);
glVertex
3
d
(
grad
_xy
*
CTX
.
vxmax
,
grad
_xy
*
CTX
.
vymax
,
0.
);
glVertex
2
d
(
grad
ient_xyfact
*
CTX
.
vxmin
,
grad
ient_xyfact
*
CTX
.
vymax
);
glVertex
3
d
(
grad
_xy
*
CTX
.
vxmin
,
grad
_xy
*
CTX
.
vymax
,
0.
);
}
}
else
{
else
{
glColor4ubv
((
GLubyte
*
)
&
CTX
.
color
.
bg
);
glColor4ubv
((
GLubyte
*
)
&
CTX
.
color
.
bg
);
glVertex
2
d
(
grad
ient_xyfact
*
CTX
.
vxmax
,
grad
ient_xyfact
*
CTX
.
vymin
);
glVertex
3
d
(
grad
_xy
*
CTX
.
vxmax
,
grad
_xy
*
CTX
.
vymin
,
0.
);
glVertex
2
d
(
grad
ient_xyfact
*
CTX
.
vxmax
,
grad
ient_xyfact
*
CTX
.
vymax
);
glVertex
3
d
(
grad
_xy
*
CTX
.
vxmax
,
grad
_xy
*
CTX
.
vymax
,
0.
);
glColor4ubv
((
GLubyte
*
)
&
CTX
.
color
.
bg_grad
);
glColor4ubv
((
GLubyte
*
)
&
CTX
.
color
.
bg_grad
);
glVertex
2
d
(
grad
ient_xyfact
*
CTX
.
vxmin
,
grad
ient_xyfact
*
CTX
.
vymax
);
glVertex
3
d
(
grad
_xy
*
CTX
.
vxmin
,
grad
_xy
*
CTX
.
vymax
,
0.
);
glVertex
2
d
(
grad
ient_xyfact
*
CTX
.
vxmin
,
grad
ient_xyfact
*
CTX
.
vymin
);
glVertex
3
d
(
grad
_xy
*
CTX
.
vxmin
,
grad
_xy
*
CTX
.
vymin
,
0.
);
}
}
glEnd
();
glEnd
();
glPopMatrix
();
glPopMatrix
();
...
@@ -288,6 +287,7 @@ void InitRenderModel(void)
...
@@ -288,6 +287,7 @@ void InitRenderModel(void)
glMaterialf
(
GL_FRONT_AND_BACK
,
GL_SHININESS
,
CTX
.
shine_exponent
);
glMaterialf
(
GL_FRONT_AND_BACK
,
GL_SHININESS
,
CTX
.
shine_exponent
);
glShadeModel
(
GL_SMOOTH
);
glShadeModel
(
GL_SMOOTH
);
// Normalize the normals automatically. We could use the more
// Normalize the normals automatically. We could use the more
// efficient glEnable(GL_RESCALE_NORMAL) instead (since we initially
// efficient glEnable(GL_RESCALE_NORMAL) instead (since we initially
// specify unit normals), but GL_RESCALE_NORMAL does only work with
// specify unit normals), but GL_RESCALE_NORMAL does only work with
...
...
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