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
f7a232d6
Commit
f7a232d6
authored
10 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
fix unproject and addPointMode for highres displays
parent
129118f2
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Fltk/openglWindow.cpp
+4
-1
4 additions, 1 deletion
Fltk/openglWindow.cpp
Graphics/drawContext.cpp
+13
-8
13 additions, 8 deletions
Graphics/drawContext.cpp
Graphics/drawContext.h
+3
-3
3 additions, 3 deletions
Graphics/drawContext.h
with
20 additions
and
12 deletions
Fltk/openglWindow.cpp
+
4
−
1
View file @
f7a232d6
...
@@ -215,7 +215,10 @@ void openglWindow::draw()
...
@@ -215,7 +215,10 @@ void openglWindow::draw()
_ctx
->
draw3d
();
_ctx
->
draw3d
();
glColor4ubv
((
GLubyte
*
)
&
CTX
::
instance
()
->
color
.
fg
);
glColor4ubv
((
GLubyte
*
)
&
CTX
::
instance
()
->
color
.
fg
);
glPointSize
((
float
)
CTX
::
instance
()
->
geom
.
pointSize
);
float
ps
=
CTX
::
instance
()
->
geom
.
pointSize
;
if
(
_ctx
->
isHighResolution
())
ps
*=
CTX
::
instance
()
->
highResolutionPointSizeFactor
;
glPointSize
(
ps
);
glBegin
(
GL_POINTS
);
glBegin
(
GL_POINTS
);
glVertex3d
(
_point
[
0
],
_point
[
1
],
_point
[
2
]);
glVertex3d
(
_point
[
0
],
_point
[
1
],
_point
[
2
]);
glEnd
();
glEnd
();
...
...
This diff is collapsed.
Click to expand it.
Graphics/drawContext.cpp
+
13
−
8
View file @
f7a232d6
...
@@ -755,21 +755,26 @@ void drawContext::initPosition()
...
@@ -755,21 +755,26 @@ void drawContext::initPosition()
// Takes a cursor position in window coordinates and returns the line (given by
// Takes a cursor position in window coordinates and returns the line (given by
// a point and a unit direction vector), in real space, that corresponds to that
// a point and a unit direction vector), in real space, that corresponds to that
// cursor position
// cursor position
void
drawContext
::
unproject
(
double
x
,
double
y
,
double
p
[
3
],
double
d
[
3
])
void
drawContext
::
unproject
(
double
win
x
,
double
win
y
,
double
p
[
3
],
double
d
[
3
])
{
{
if
(
isHighResolution
()){
winx
*=
2
;
// true pixels
winy
*=
2
;
}
GLint
vp
[
4
];
GLint
vp
[
4
];
glGetIntegerv
(
GL_VIEWPORT
,
vp
);
glGetIntegerv
(
GL_VIEWPORT
,
vp
);
y
=
vp
[
3
]
-
y
;
win
y
=
vp
[
3
]
-
win
y
;
GLdouble
x0
,
y0
,
z0
,
x1
,
y1
,
z1
;
GLdouble
x0
,
y0
,
z0
,
x1
,
y1
,
z1
;
// we use the stored model and proj matrices instead of directly
// we use the stored model and proj matrices instead of directly
// getGetDouble'ing the matrices since unproject can be called in or after
// getGetDouble'ing the matrices since unproject can be called in or after
// draw2d
// draw2d
if
(
!
gluUnProject
(
x
,
y
,
0.0
,
model
,
proj
,
vp
,
&
x0
,
&
y0
,
&
z0
))
if
(
!
gluUnProject
(
winx
,
win
y
,
0.0
,
model
,
proj
,
vp
,
&
x0
,
&
y0
,
&
z0
))
Msg
::
Warning
(
"unproject1 failed"
);
Msg
::
Warning
(
"unproject1 failed"
);
if
(
!
gluUnProject
(
x
,
y
,
1.0
,
model
,
proj
,
vp
,
&
x1
,
&
y1
,
&
z1
))
if
(
!
gluUnProject
(
winx
,
win
y
,
1.0
,
model
,
proj
,
vp
,
&
x1
,
&
y1
,
&
z1
))
Msg
::
Warning
(
"unproject2 failed"
);
Msg
::
Warning
(
"unproject2 failed"
);
p
[
0
]
=
x0
;
p
[
0
]
=
x0
;
...
@@ -784,24 +789,24 @@ void drawContext::unproject(double x, double y, double p[3], double d[3])
...
@@ -784,24 +789,24 @@ void drawContext::unproject(double x, double y, double p[3], double d[3])
d
[
2
]
/=
len
;
d
[
2
]
/=
len
;
}
}
void
drawContext
::
viewport2World
(
double
win
[
3
],
double
xyz
[
3
])
void
drawContext
::
viewport2World
(
double
vp
[
3
],
double
xyz
[
3
])
{
{
GLint
viewport
[
4
];
GLint
viewport
[
4
];
GLdouble
model
[
16
],
proj
[
16
];
GLdouble
model
[
16
],
proj
[
16
];
glGetIntegerv
(
GL_VIEWPORT
,
viewport
);
glGetIntegerv
(
GL_VIEWPORT
,
viewport
);
glGetDoublev
(
GL_PROJECTION_MATRIX
,
proj
);
glGetDoublev
(
GL_PROJECTION_MATRIX
,
proj
);
glGetDoublev
(
GL_MODELVIEW_MATRIX
,
model
);
glGetDoublev
(
GL_MODELVIEW_MATRIX
,
model
);
gluUnProject
(
win
[
0
],
win
[
1
],
win
[
2
],
model
,
proj
,
viewport
,
&
xyz
[
0
],
&
xyz
[
1
],
&
xyz
[
2
]);
gluUnProject
(
vp
[
0
],
vp
[
1
],
vp
[
2
],
model
,
proj
,
viewport
,
&
xyz
[
0
],
&
xyz
[
1
],
&
xyz
[
2
]);
}
}
void
drawContext
::
world2Viewport
(
double
xyz
[
3
],
double
win
[
3
])
void
drawContext
::
world2Viewport
(
double
xyz
[
3
],
double
vp
[
3
])
{
{
GLint
viewport
[
4
];
GLint
viewport
[
4
];
GLdouble
model
[
16
],
proj
[
16
];
GLdouble
model
[
16
],
proj
[
16
];
glGetIntegerv
(
GL_VIEWPORT
,
viewport
);
glGetIntegerv
(
GL_VIEWPORT
,
viewport
);
glGetDoublev
(
GL_PROJECTION_MATRIX
,
proj
);
glGetDoublev
(
GL_PROJECTION_MATRIX
,
proj
);
glGetDoublev
(
GL_MODELVIEW_MATRIX
,
model
);
glGetDoublev
(
GL_MODELVIEW_MATRIX
,
model
);
gluProject
(
xyz
[
0
],
xyz
[
1
],
xyz
[
2
],
model
,
proj
,
viewport
,
&
win
[
0
],
&
win
[
1
],
&
win
[
2
]);
gluProject
(
xyz
[
0
],
xyz
[
1
],
xyz
[
2
],
model
,
proj
,
viewport
,
&
vp
[
0
],
&
vp
[
1
],
&
vp
[
2
]);
}
}
class
hit
{
class
hit
{
...
...
This diff is collapsed.
Click to expand it.
Graphics/drawContext.h
+
3
−
3
View file @
f7a232d6
...
@@ -191,9 +191,9 @@ class drawContext {
...
@@ -191,9 +191,9 @@ class drawContext {
void
initProjection
(
int
xpick
=
0
,
int
ypick
=
0
,
int
wpick
=
0
,
int
hpick
=
0
);
void
initProjection
(
int
xpick
=
0
,
int
ypick
=
0
,
int
wpick
=
0
,
int
hpick
=
0
);
void
initRenderModel
();
void
initRenderModel
();
void
initPosition
();
void
initPosition
();
void
unproject
(
double
x
,
double
y
,
double
p
[
3
],
double
d
[
3
]);
void
unproject
(
double
win
x
,
double
win
y
,
double
p
[
3
],
double
d
[
3
]);
void
viewport2World
(
double
win
[
3
],
double
xyz
[
3
]);
void
viewport2World
(
double
vp
[
3
],
double
xyz
[
3
]);
void
world2Viewport
(
double
xyz
[
3
],
double
win
[
3
]);
void
world2Viewport
(
double
xyz
[
3
],
double
vp
[
3
]);
bool
select
(
int
type
,
bool
multiple
,
bool
mesh
,
int
x
,
int
y
,
int
w
,
int
h
,
bool
select
(
int
type
,
bool
multiple
,
bool
mesh
,
int
x
,
int
y
,
int
w
,
int
h
,
std
::
vector
<
GVertex
*>
&
vertices
,
std
::
vector
<
GEdge
*>
&
edges
,
std
::
vector
<
GVertex
*>
&
vertices
,
std
::
vector
<
GEdge
*>
&
edges
,
std
::
vector
<
GFace
*>
&
faces
,
std
::
vector
<
GRegion
*>
&
regions
,
std
::
vector
<
GFace
*>
&
faces
,
std
::
vector
<
GRegion
*>
&
regions
,
...
...
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