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
8552a6e2
Commit
8552a6e2
authored
Jun 20, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed some minor rendering issues, mostyl for shaderless OpenGL GAL.
parent
fd6ab600
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
32 deletions
+36
-32
opengl_gal.cpp
common/gal/opengl/opengl_gal.cpp
+34
-28
vbo_container.cpp
common/gal/opengl/vbo_container.cpp
+2
-4
No files found.
common/gal/opengl/opengl_gal.cpp
View file @
8552a6e2
...
@@ -1101,7 +1101,7 @@ void OPENGL_GAL::DrawCircle( const VECTOR2D& aCenterPoint, double aRadius )
...
@@ -1101,7 +1101,7 @@ void OPENGL_GAL::DrawCircle( const VECTOR2D& aCenterPoint, double aRadius )
Save
();
Save
();
translate3
(
aCenterPoint
.
x
,
aCenterPoint
.
y
,
0.0
);
translate3
(
aCenterPoint
.
x
,
aCenterPoint
.
y
,
layerDepth
);
Scale
(
VECTOR2D
(
aRadius
,
aRadius
)
);
Scale
(
VECTOR2D
(
aRadius
,
aRadius
)
);
begin
(
GL_TRIANGLES
);
begin
(
GL_TRIANGLES
);
...
@@ -1114,13 +1114,13 @@ void OPENGL_GAL::DrawCircle( const VECTOR2D& aCenterPoint, double aRadius )
...
@@ -1114,13 +1114,13 @@ void OPENGL_GAL::DrawCircle( const VECTOR2D& aCenterPoint, double aRadius )
double
v2
[]
=
{
(
it
+
1
)
->
x
*
innerScale
,
(
it
+
1
)
->
y
*
innerScale
};
double
v2
[]
=
{
(
it
+
1
)
->
x
*
innerScale
,
(
it
+
1
)
->
y
*
innerScale
};
double
v3
[]
=
{
(
it
+
1
)
->
x
*
outerScale
,
(
it
+
1
)
->
y
*
outerScale
};
double
v3
[]
=
{
(
it
+
1
)
->
x
*
outerScale
,
(
it
+
1
)
->
y
*
outerScale
};
vertex3
(
v0
[
0
],
v0
[
1
],
layerDepth
);
vertex3
(
v0
[
0
],
v0
[
1
],
0.0
);
vertex3
(
v1
[
0
],
v1
[
1
],
layerDepth
);
vertex3
(
v1
[
0
],
v1
[
1
],
0.0
);
vertex3
(
v2
[
0
],
v2
[
1
],
layerDepth
);
vertex3
(
v2
[
0
],
v2
[
1
],
0.0
);
vertex3
(
v1
[
0
],
v1
[
1
],
layerDepth
);
vertex3
(
v1
[
0
],
v1
[
1
],
0.0
);
vertex3
(
v3
[
0
],
v3
[
1
],
layerDepth
);
vertex3
(
v3
[
0
],
v3
[
1
],
0.0
);
vertex3
(
v2
[
0
],
v2
[
1
],
layerDepth
);
vertex3
(
v2
[
0
],
v2
[
1
],
0.0
);
}
}
end
();
end
();
...
@@ -1135,12 +1135,12 @@ void OPENGL_GAL::DrawCircle( const VECTOR2D& aCenterPoint, double aRadius )
...
@@ -1135,12 +1135,12 @@ void OPENGL_GAL::DrawCircle( const VECTOR2D& aCenterPoint, double aRadius )
color4
(
fillColor
.
r
,
fillColor
.
g
,
fillColor
.
b
,
fillColor
.
a
);
color4
(
fillColor
.
r
,
fillColor
.
g
,
fillColor
.
b
,
fillColor
.
a
);
Save
();
Save
();
translate3
(
aCenterPoint
.
x
,
aCenterPoint
.
y
,
layerDepth
);
translate3
(
aCenterPoint
.
x
,
aCenterPoint
.
y
,
layerDepth
);
Scale
(
VECTOR2D
(
aRadius
,
aRadius
)
);
Scale
(
VECTOR2D
(
aRadius
,
aRadius
)
);
if
(
isGrouping
)
if
(
isGrouping
)
{
{
// Multiplied by 3, as this is the number of vertices in a single triangle
VBO_VERTEX
*
circle
=
new
VBO_VERTEX
[
CIRCLE_POINTS
*
3
];
VBO_VERTEX
*
circle
=
new
VBO_VERTEX
[
CIRCLE_POINTS
*
3
];
memcpy
(
circle
,
verticesCircle
->
GetVertices
(),
memcpy
(
circle
,
verticesCircle
->
GetVertices
(),
...
@@ -1197,11 +1197,12 @@ void OPENGL_GAL::drawSemiCircle( const VECTOR2D& aCenterPoint, double aRadius, d
...
@@ -1197,11 +1197,12 @@ void OPENGL_GAL::drawSemiCircle( const VECTOR2D& aCenterPoint, double aRadius, d
if
(
isGrouping
)
if
(
isGrouping
)
{
{
VBO_VERTEX
*
semiCircle
=
new
VBO_VERTEX
[
CIRCLE_POINTS
*
3
];
// Multiplied by 3, as this is the number of vertices in a single triangle
VBO_VERTEX
*
semiCircle
=
new
VBO_VERTEX
[
CIRCLE_POINTS
/
2
*
3
];
memcpy
(
semiCircle
,
verticesSemiCircle
->
GetVertices
(),
memcpy
(
semiCircle
,
verticesSemiCircle
->
GetVertices
(),
VBO_ITEM
::
VertByteSize
*
CIRCLE_POINTS
*
3
);
VBO_ITEM
::
VertByteSize
*
CIRCLE_POINTS
/
2
*
3
);
curVboItem
->
PushVertices
(
semiCircle
,
CIRCLE_POINTS
*
3
);
curVboItem
->
PushVertices
(
semiCircle
,
CIRCLE_POINTS
/
2
*
3
);
delete
[]
semiCircle
;
delete
[]
semiCircle
;
}
}
...
@@ -1233,7 +1234,7 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double a
...
@@ -1233,7 +1234,7 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double a
VECTOR2D
middlePoint
=
0.5
*
startEndPoint
;
VECTOR2D
middlePoint
=
0.5
*
startEndPoint
;
Save
();
Save
();
translate3
(
aCenterPoint
.
x
,
aCenterPoint
.
y
,
0.0
);
translate3
(
aCenterPoint
.
x
,
aCenterPoint
.
y
,
layerDepth
);
if
(
isStrokeEnabled
)
if
(
isStrokeEnabled
)
{
{
...
@@ -1243,16 +1244,21 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double a
...
@@ -1243,16 +1244,21 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double a
color4
(
strokeColor
.
r
,
strokeColor
.
g
,
strokeColor
.
b
,
strokeColor
.
a
);
color4
(
strokeColor
.
r
,
strokeColor
.
g
,
strokeColor
.
b
,
strokeColor
.
a
);
VECTOR2D
p
(
cos
(
aStartAngle
)
*
aRadius
,
sin
(
aStartAngle
)
*
aRadius
);
VECTOR2D
p
(
cos
(
aStartAngle
)
*
aRadius
,
sin
(
aStartAngle
)
*
aRadius
);
for
(
double
alpha
=
aStartAngle
;
alpha
<
aEndAngle
;
alpha
+=
alphaIncrement
)
double
alpha
;
for
(
alpha
=
aStartAngle
+
alphaIncrement
;
alpha
<
aEndAngle
;
alpha
+=
alphaIncrement
)
{
{
if
(
alpha
>
aEndAngle
)
alpha
=
aEndAngle
;
VECTOR2D
p_next
(
cos
(
alpha
)
*
aRadius
,
sin
(
alpha
)
*
aRadius
);
VECTOR2D
p_next
(
cos
(
alpha
)
*
aRadius
,
sin
(
alpha
)
*
aRadius
);
DrawLine
(
p
,
p_next
);
DrawLine
(
p
,
p_next
);
p
=
p_next
;
p
=
p_next
;
}
}
// Draw the last missing part
if
(
alpha
!=
aEndAngle
)
{
VECTOR2D
p_last
(
cos
(
aEndAngle
)
*
aRadius
,
sin
(
aEndAngle
)
*
aRadius
);
DrawLine
(
p
,
p_last
);
}
}
}
else
else
{
{
...
@@ -1282,13 +1288,13 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double a
...
@@ -1282,13 +1288,13 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double a
double
v2
[]
=
{
cos
(
alpha
)
*
innerScale
,
sin
(
alpha
)
*
innerScale
};
double
v2
[]
=
{
cos
(
alpha
)
*
innerScale
,
sin
(
alpha
)
*
innerScale
};
double
v3
[]
=
{
cos
(
alpha
)
*
outerScale
,
sin
(
alpha
)
*
outerScale
};
double
v3
[]
=
{
cos
(
alpha
)
*
outerScale
,
sin
(
alpha
)
*
outerScale
};
vertex3
(
v0
[
0
],
v0
[
1
],
layerDepth
);
vertex3
(
v0
[
0
],
v0
[
1
],
0.0
);
vertex3
(
v1
[
0
],
v1
[
1
],
layerDepth
);
vertex3
(
v1
[
0
],
v1
[
1
],
0.0
);
vertex3
(
v2
[
0
],
v2
[
1
],
layerDepth
);
vertex3
(
v2
[
0
],
v2
[
1
],
0.0
);
vertex3
(
v1
[
0
],
v1
[
1
],
layerDepth
);
vertex3
(
v1
[
0
],
v1
[
1
],
0.0
);
vertex3
(
v3
[
0
],
v3
[
1
],
layerDepth
);
vertex3
(
v3
[
0
],
v3
[
1
],
0.0
);
vertex3
(
v2
[
0
],
v2
[
1
],
layerDepth
);
vertex3
(
v2
[
0
],
v2
[
1
],
0.0
);
}
}
end
();
end
();
...
@@ -1311,15 +1317,15 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double a
...
@@ -1311,15 +1317,15 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double a
for
(
alpha
=
aStartAngle
;
(
alpha
+
alphaIncrement
)
<
aEndAngle
;
)
for
(
alpha
=
aStartAngle
;
(
alpha
+
alphaIncrement
)
<
aEndAngle
;
)
{
{
vertex3
(
middlePoint
.
x
,
middlePoint
.
y
,
layerDepth
);
vertex3
(
middlePoint
.
x
,
middlePoint
.
y
,
0.0
);
vertex3
(
cos
(
alpha
),
sin
(
alpha
),
layerDepth
);
vertex3
(
cos
(
alpha
),
sin
(
alpha
),
0.0
);
alpha
+=
alphaIncrement
;
alpha
+=
alphaIncrement
;
vertex3
(
cos
(
alpha
),
sin
(
alpha
),
layerDepth
);
vertex3
(
cos
(
alpha
),
sin
(
alpha
),
0.0
);
}
}
vertex3
(
middlePoint
.
x
,
middlePoint
.
y
,
layerDepth
);
vertex3
(
middlePoint
.
x
,
middlePoint
.
y
,
0.0
);
vertex3
(
cos
(
alpha
),
sin
(
alpha
),
layerDepth
);
vertex3
(
cos
(
alpha
),
sin
(
alpha
),
0.0
);
vertex3
(
endPoint
.
x
,
endPoint
.
y
,
layerDepth
);
vertex3
(
endPoint
.
x
,
endPoint
.
y
,
0.0
);
end
();
end
();
}
}
...
...
common/gal/opengl/vbo_container.cpp
View file @
8552a6e2
...
@@ -34,8 +34,6 @@
...
@@ -34,8 +34,6 @@
#include <profile.h>
#include <profile.h>
#endif
/* __WXDEBUG__ */
#endif
/* __WXDEBUG__ */
#define CONTAINER_TEST 1
using
namespace
KiGfx
;
using
namespace
KiGfx
;
VBO_CONTAINER
::
VBO_CONTAINER
(
int
aSize
)
:
VBO_CONTAINER
::
VBO_CONTAINER
(
int
aSize
)
:
...
@@ -181,9 +179,9 @@ void VBO_CONTAINER::Add( VBO_ITEM* aVboItem, const VBO_VERTEX* aVertex, unsigned
...
@@ -181,9 +179,9 @@ void VBO_CONTAINER::Add( VBO_ITEM* aVboItem, const VBO_VERTEX* aVertex, unsigned
vertexPtr
->
a
=
m_color
[
3
];
vertexPtr
->
a
=
m_color
[
3
];
// Apply currently used shader
// Apply currently used shader
for
(
unsigned
int
i
=
0
;
i
<
VBO_ITEM
::
ShaderStride
;
++
i
)
for
(
unsigned
int
j
=
0
;
j
<
VBO_ITEM
::
ShaderStride
;
++
j
)
{
{
vertexPtr
->
shader
[
i
]
=
m_shader
[
i
];
vertexPtr
->
shader
[
j
]
=
m_shader
[
j
];
}
}
}
}
...
...
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