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
f3c7b855
Commit
f3c7b855
authored
14 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
fix drawing of gl text in 64 bit mac cocoa version by making sure the raster position is valid
parent
0892b8c9
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/drawGlyph.cpp
+26
-24
26 additions, 24 deletions
Graphics/drawGlyph.cpp
with
26 additions
and
24 deletions
Graphics/drawGlyph.cpp
+
26
−
24
View file @
f3c7b855
...
@@ -17,32 +17,32 @@ void drawContext::drawString(const std::string &s, const std::string &font_name,
...
@@ -17,32 +17,32 @@ void drawContext::drawString(const std::string &s, const std::string &font_name,
{
{
if
(
CTX
::
instance
()
->
printing
&&
!
CTX
::
instance
()
->
print
.
text
)
return
;
if
(
CTX
::
instance
()
->
printing
&&
!
CTX
::
instance
()
->
print
.
text
)
return
;
GLboolean
valid
;
glGetBooleanv
(
GL_CURRENT_RASTER_POSITION_VALID
,
&
valid
);
if
(
valid
==
GL_FALSE
)
return
;
// the primitive is culled
// change the raster position only if not creating TeX files
// change the raster position only if not creating TeX files
if
(
align
>
0
&&
(
!
CTX
::
instance
()
->
printing
||
if
(
align
>
0
&&
(
!
CTX
::
instance
()
->
printing
||
CTX
::
instance
()
->
print
.
fileFormat
!=
FORMAT_TEX
)){
CTX
::
instance
()
->
print
.
fileFormat
!=
FORMAT_TEX
)){
GLboolean
valid
;
GLdouble
pos
[
4
];
glGetBooleanv
(
GL_CURRENT_RASTER_POSITION_VALID
,
&
valid
);
glGetDoublev
(
GL_CURRENT_RASTER_POSITION
,
pos
);
if
(
valid
==
GL_TRUE
){
double
x
[
3
],
w
[
3
]
=
{
pos
[
0
],
pos
[
1
],
pos
[
2
]};
GLdouble
pos
[
4
];
drawContext
::
global
()
->
setFont
(
font_enum
,
font_size
);
glGetDoublev
(
GL_CURRENT_RASTER_POSITION
,
pos
);
double
width
=
drawContext
::
global
()
->
getStringWidth
(
s
.
c_str
());
double
x
[
3
],
w
[
3
]
=
{
pos
[
0
],
pos
[
1
],
pos
[
2
]};
double
height
=
drawContext
::
global
()
->
getStringHeight
();
drawContext
::
global
()
->
setFont
(
font_enum
,
font_size
);
switch
(
align
){
double
width
=
drawContext
::
global
()
->
getStringWidth
(
s
.
c_str
());
case
1
:
w
[
0
]
-=
width
/
2.
;
break
;
// bottom center
double
height
=
drawContext
::
global
()
->
getStringHeight
();
case
2
:
w
[
0
]
-=
width
;
break
;
// bottom right
switch
(
align
){
case
3
:
w
[
1
]
-=
height
;
break
;
// top left
case
1
:
w
[
0
]
-=
width
/
2.
;
break
;
// bottom center
case
4
:
w
[
0
]
-=
width
/
2.
;
w
[
1
]
-=
height
;
break
;
// top center
case
2
:
w
[
0
]
-=
width
;
break
;
// bottom right
case
5
:
w
[
0
]
-=
width
;
w
[
1
]
-=
height
;
break
;
// top right
case
3
:
w
[
1
]
-=
height
;
break
;
// top left
case
6
:
w
[
1
]
-=
height
/
2.
;
break
;
// center left
case
4
:
w
[
0
]
-=
width
/
2.
;
w
[
1
]
-=
height
;
break
;
// top center
case
7
:
w
[
0
]
-=
width
/
2.
;
w
[
1
]
-=
height
/
2.
;
break
;
// center center
case
5
:
w
[
0
]
-=
width
;
w
[
1
]
-=
height
;
break
;
// top right
case
8
:
w
[
0
]
-=
width
;
w
[
1
]
-=
height
/
2.
;
break
;
// center right
case
6
:
w
[
1
]
-=
height
/
2.
;
break
;
// center left
default:
break
;
case
7
:
w
[
0
]
-=
width
/
2.
;
w
[
1
]
-=
height
/
2.
;
break
;
// center center
case
8
:
w
[
0
]
-=
width
;
w
[
1
]
-=
height
/
2.
;
break
;
// center right
default:
break
;
}
viewport2World
(
w
,
x
);
glRasterPos3d
(
x
[
0
],
x
[
1
],
x
[
2
]);
}
}
viewport2World
(
w
,
x
);
glRasterPos3d
(
x
[
0
],
x
[
1
],
x
[
2
]);
}
}
if
(
!
CTX
::
instance
()
->
printing
){
if
(
!
CTX
::
instance
()
->
printing
){
...
@@ -128,7 +128,8 @@ void drawContext::drawSphere(double R, double x, double y, double z,
...
@@ -128,7 +128,8 @@ void drawContext::drawSphere(double R, double x, double y, double z,
glDisable
(
GL_LIGHTING
);
glDisable
(
GL_LIGHTING
);
}
}
void
drawContext
::
drawEllipse
(
double
x
,
double
y
,
double
z
,
float
v0
[
3
],
float
v1
[
3
],
int
light
)
void
drawContext
::
drawEllipse
(
double
x
,
double
y
,
double
z
,
float
v0
[
3
],
float
v1
[
3
],
int
light
)
{
{
if
(
light
)
glEnable
(
GL_LIGHTING
);
if
(
light
)
glEnable
(
GL_LIGHTING
);
glPushMatrix
();
glPushMatrix
();
...
@@ -144,7 +145,8 @@ void drawContext::drawEllipse(double x, double y, double z, float v0[3], float v
...
@@ -144,7 +145,8 @@ void drawContext::drawEllipse(double x, double y, double z, float v0[3], float v
glDisable
(
GL_LIGHTING
);
glDisable
(
GL_LIGHTING
);
}
}
void
drawContext
::
drawEllipsoid
(
double
x
,
double
y
,
double
z
,
float
v0
[
3
],
float
v1
[
3
],
float
v2
[
3
],
int
light
)
void
drawContext
::
drawEllipsoid
(
double
x
,
double
y
,
double
z
,
float
v0
[
3
],
float
v1
[
3
],
float
v2
[
3
],
int
light
)
{
{
if
(
light
)
glEnable
(
GL_LIGHTING
);
if
(
light
)
glEnable
(
GL_LIGHTING
);
glPushMatrix
();
glPushMatrix
();
...
...
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