Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
0f5aa063
Commit
0f5aa063
authored
Jul 02, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed stroke semicircles drawing using shaderless OpenGL backend.
parent
6dc79cf1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
41 deletions
+36
-41
opengl_gal.cpp
common/gal/opengl/opengl_gal.cpp
+36
-41
No files found.
common/gal/opengl/opengl_gal.cpp
View file @
0f5aa063
...
@@ -1024,56 +1024,51 @@ void OPENGL_GAL::drawStrokedSemiCircle( const VECTOR2D& aCenterPoint, double aRa
...
@@ -1024,56 +1024,51 @@ void OPENGL_GAL::drawStrokedSemiCircle( const VECTOR2D& aCenterPoint, double aRa
else
else
{
{
// Compute the factors for the unit circle
// Compute the factors for the unit circle
double
outerScale
=
lineWidth
/
aRadius
/
2
;
double
innerScale
=
1.0
-
lineWidth
/
aRadius
;
double
innerScale
=
-
outerScale
;
outerScale
+=
1.0
;
innerScale
+=
1.0
;
if
(
innerScale
<
outerScale
)
Save
();
{
Translate
(
aCenterPoint
);
Save
();
Scale
(
VECTOR2D
(
aRadius
,
aRadius
)
);
Translate
(
aCenterPoint
);
Rotate
(
aAngle
);
Rotate
(
aAngle
);
// Draw the outline
VBO_VERTEX
*
circle
=
verticesCircle
->
GetVertices
();
int
next
;
begin
(
GL_TRIANGLES
);
for
(
int
i
=
0
;
i
<
(
3
*
CIRCLE_POINTS
)
/
2
;
++
i
)
// Draw the outline
{
VBO_VERTEX
*
circle
=
verticesCircle
->
GetVertices
();
// verticesCircle contains precomputed circle points interleaved with vertex
int
next
;
// (0,0,0), so filled circles can be drawn as consecutive triangles, ie:
// { 0,a,b, 0,c,d, 0,e,f, 0,g,h, ... }
// where letters stand for consecutive circle points and 0 for (0,0,0) vertex.
// We have to skip all (0,0,0) vertices (every third vertex)
begin
(
GL_TRIANGLES
);
if
(
i
%
3
==
0
)
{
i
++
;
// Depending on the vertex, next circle point may be stored in the next vertex..
next
=
i
+
1
;
}
else
{
// ..or 2 vertices away (in case it is preceded by (0,0,0) vertex)
next
=
i
+
2
;
}
vertex3
(
circle
[
i
].
x
*
innerScale
,
circle
[
i
].
y
*
innerScale
,
layerDepth
);
for
(
int
i
=
0
;
i
<
(
3
*
CIRCLE_POINTS
)
/
2
;
++
i
)
vertex3
(
circle
[
i
].
x
*
outerScale
,
circle
[
i
].
y
*
outerScale
,
layerDepth
);
{
vertex3
(
circle
[
next
].
x
*
innerScale
,
circle
[
next
].
y
*
innerScale
,
layerDepth
);
// verticesCircle contains precomputed circle points interleaved with vertex
// (0,0,0), so filled circles can be drawn as consecutive triangles, ie:
// { 0,a,b, 0,c,d, 0,e,f, 0,g,h, ... }
// where letters stand for consecutive circle points and 0 for (0,0,0) vertex.
vertex3
(
circle
[
i
].
x
*
outerScale
,
circle
[
i
].
y
*
outerScale
,
layerDepth
);
// We have to skip all (0,0,0) vertices (every third vertex)
vertex3
(
circle
[
next
].
x
*
outerScale
,
circle
[
next
].
y
*
outerScale
,
layerDepth
);
if
(
i
%
3
==
0
)
vertex3
(
circle
[
next
].
x
*
innerScale
,
circle
[
next
].
y
*
innerScale
,
layerDepth
);
{
i
++
;
// Depending on the vertex, next circle point may be stored in the next vertex..
next
=
i
+
1
;
}
else
{
// ..or 2 vertices away (in case it is preceded by (0,0,0) vertex)
next
=
i
+
2
;
}
}
end
();
vertex3
(
circle
[
i
].
x
*
innerScale
,
circle
[
i
].
y
*
innerScale
,
layerDepth
);
vertex3
(
circle
[
i
].
x
,
circle
[
i
].
y
,
layerDepth
);
vertex3
(
circle
[
next
].
x
*
innerScale
,
circle
[
next
].
y
*
innerScale
,
layerDepth
);
Restore
();
vertex3
(
circle
[
i
].
x
,
circle
[
i
].
y
,
layerDepth
);
vertex3
(
circle
[
next
].
x
,
circle
[
next
].
y
,
layerDepth
);
vertex3
(
circle
[
next
].
x
*
innerScale
,
circle
[
next
].
y
*
innerScale
,
layerDepth
);
}
}
end
();
Restore
();
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment