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
a6c8beb7
Commit
a6c8beb7
authored
May 14, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drawing tracks using PushVertices, added some comments, fixed formatting.
parent
32784ea1
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
83 additions
and
51 deletions
+83
-51
opengl_gal.cpp
common/gal/opengl/opengl_gal.cpp
+54
-36
round.vert
common/gal/opengl/shader/round.vert
+1
-1
vbo_item.cpp
common/gal/opengl/vbo_item.cpp
+4
-4
vbo_item.h
include/gal/opengl/vbo_item.h
+24
-10
No files found.
common/gal/opengl/opengl_gal.cpp
View file @
a6c8beb7
...
...
@@ -615,20 +615,35 @@ inline void OPENGL_GAL::drawLineQuad( const VECTOR2D& aStartPoint, const VECTOR2
VECTOR2D
perpendicularVector
(
-
startEndVector
.
y
*
scale
,
startEndVector
.
x
*
scale
);
// Compute the edge points of the line
VECTOR2D
point1
=
aStartPoint
+
perpendicularVector
;
VECTOR2D
point2
=
aStartPoint
-
perpendicularVector
;
VECTOR2D
point3
=
aEndPoint
+
perpendicularVector
;
VECTOR2D
point4
=
aEndPoint
-
perpendicularVector
;
VECTOR2D
v0
=
aStartPoint
+
perpendicularVector
;
VECTOR2D
v1
=
aStartPoint
-
perpendicularVector
;
VECTOR2D
v2
=
aEndPoint
+
perpendicularVector
;
VECTOR2D
v3
=
aEndPoint
-
perpendicularVector
;
if
(
isGrouping
)
{
GLfloat
newVertices
[]
=
{
v0
.
x
,
v0
.
y
,
layerDepth
,
strokeColor
.
r
,
strokeColor
.
g
,
strokeColor
.
b
,
strokeColor
.
a
,
v1
.
x
,
v1
.
y
,
layerDepth
,
strokeColor
.
r
,
strokeColor
.
g
,
strokeColor
.
b
,
strokeColor
.
a
,
v3
.
x
,
v3
.
y
,
layerDepth
,
strokeColor
.
r
,
strokeColor
.
g
,
strokeColor
.
b
,
strokeColor
.
a
,
v0
.
x
,
v0
.
y
,
layerDepth
,
strokeColor
.
r
,
strokeColor
.
g
,
strokeColor
.
b
,
strokeColor
.
a
,
v3
.
x
,
v3
.
y
,
layerDepth
,
strokeColor
.
r
,
strokeColor
.
g
,
strokeColor
.
b
,
strokeColor
.
a
,
v2
.
x
,
v2
.
y
,
layerDepth
,
strokeColor
.
r
,
strokeColor
.
g
,
strokeColor
.
b
,
strokeColor
.
a
};
curVboItem
->
PushVertices
(
newVertices
,
6
);
}
else
{
glBegin
(
GL_TRIANGLES
);
glVertex3d
(
point1
.
x
,
point1
.
y
,
layerDepth
);
glVertex3d
(
point2
.
x
,
point2
.
y
,
layerDepth
);
glVertex3d
(
point4
.
x
,
point4
.
y
,
layerDepth
);
glVertex3d
(
v0
.
x
,
v0
.
y
,
layerDepth
);
glVertex3d
(
v1
.
x
,
v1
.
y
,
layerDepth
);
glVertex3d
(
v3
.
x
,
v3
.
y
,
layerDepth
);
glVertex3d
(
point1
.
x
,
point1
.
y
,
layerDepth
);
glVertex3d
(
point4
.
x
,
point4
.
y
,
layerDepth
);
glVertex3d
(
point3
.
x
,
point3
.
y
,
layerDepth
);
glVertex3d
(
v0
.
x
,
v0
.
y
,
layerDepth
);
glVertex3d
(
v3
.
x
,
v3
.
y
,
layerDepth
);
glVertex3d
(
v2
.
x
,
v2
.
y
,
layerDepth
);
glEnd
();
}
}
...
...
@@ -637,7 +652,7 @@ void OPENGL_GAL::DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndP
VECTOR2D
startEndVector
=
aEndPoint
-
aStartPoint
;
double
lineAngle
=
atan2
(
startEndVector
.
y
,
startEndVector
.
x
);
if
(
isGrouping
)
/*
if ( isGrouping )
{
// Angle of a line perpendicular to the segment being drawn
double beta = ( M_PI / 2.0 ) - lineAngle;
...
...
@@ -662,9 +677,11 @@ void OPENGL_GAL::DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndP
};
curVboItem->PushVertices( newVertices, 6 );
}
else*/
{
if
(
isFillEnabled
)
{
if
(
!
isGrouping
)
glColor4d
(
fillColor
.
r
,
fillColor
.
g
,
fillColor
.
b
,
fillColor
.
a
);
SetLineWidth
(
aWidth
);
...
...
@@ -694,6 +711,7 @@ void OPENGL_GAL::DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndP
glPopMatrix
();
}
}
}
...
...
common/gal/opengl/shader/round.vert
View file @
a6c8beb7
common/gal/opengl/vbo_item.cpp
View file @
a6c8beb7
...
...
@@ -86,7 +86,7 @@ void VBO_ITEM::PushVertex( const GLfloat* aVertex )
}
void
VBO_ITEM
::
PushVertices
(
const
GLfloat
*
aVert
ex
,
GLuint
aSize
)
void
VBO_ITEM
::
PushVertices
(
const
GLfloat
*
aVert
ices
,
GLuint
aSize
)
{
int
newSize
=
m_size
+
aSize
;
GLfloat
*
newVertices
=
new
GLfloat
[
newSize
*
VertStride
];
...
...
@@ -101,8 +101,8 @@ void VBO_ITEM::PushVertices( const GLfloat* aVertex, GLuint aSize )
}
m_vertices
=
newVertices
;
// Add
the new vertex
memcpy
(
&
newVertices
[
m_size
*
VertStride
],
aVert
ex
,
aSize
*
VertSize
);
// Add
new vertices
memcpy
(
&
newVertices
[
m_size
*
VertStride
],
aVert
ices
,
aSize
*
VertSize
);
// Handle new indices
if
(
m_indices
)
...
...
@@ -160,7 +160,7 @@ void SetVbo( int aVboId )
}
int GetVbo()
int GetVbo()
const
{
}
*/
include/gal/opengl/vbo_item.h
View file @
a6c8beb7
...
...
@@ -43,9 +43,23 @@ public:
VBO_ITEM
();
~
VBO_ITEM
();
// TODO comments
/**
* Function PushVertex()
* Adds a single vertex to the VBO_ITEM. Vertex contains information about coordinates and
* colors and has to follow the specified format {X,Y,Z,R,G,B,A}.
* @param aVertex is a vertex to be added.
*/
void
PushVertex
(
const
GLfloat
*
aVertex
);
void
PushVertices
(
const
GLfloat
*
aVertex
,
GLuint
aSize
);
/**
* Function PushVertices()
* Adds multiple vertices to the VBO_ITEM. This function is recommended over multiple calls to
* PushVertex, as it does less memory reallocations. Vertices contain information about
* coordinates and colors and has to follow the specified format {X,Y,Z,R,G,B,A}.
* @param aVertices are vertices to be added.
* @param aSize is an amount of vertices to be added.
*/
void
PushVertices
(
const
GLfloat
*
aVertices
,
GLuint
aSize
);
/**
* Function GetVertices()
...
...
@@ -79,7 +93,7 @@ public:
///< Functions for getting VBO ids.
//void SetVbo( int aVboId );
//int GetVbo();
//int GetVbo()
const
;
///< Data organization information for vertices.
static
const
int
VertStride
=
7
;
...
...
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