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
7a1718d0
Commit
7a1718d0
authored
May 16, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed functions for adding vertices in VBO mode to make code easier to read and understand.
parent
2579fd52
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
149 additions
and
349 deletions
+149
-349
opengl_gal.cpp
common/gal/opengl/opengl_gal.cpp
+115
-342
vbo_item.cpp
common/gal/opengl/vbo_item.cpp
+9
-5
opengl_gal.h
include/gal/opengl/opengl_gal.h
+20
-0
vbo_item.h
include/gal/opengl/vbo_item.h
+5
-2
No files found.
common/gal/opengl/opengl_gal.cpp
View file @
7a1718d0
This diff is collapsed.
Click to expand it.
common/gal/opengl/vbo_item.cpp
View file @
7a1718d0
...
...
@@ -72,9 +72,6 @@ void VBO_ITEM::PushVertex( const GLfloat* aVertex )
if
(
m_spaceLeft
==
0
)
useNewBlock
();
// Add the new vertex
memcpy
(
m_vertPtr
,
aVertex
,
VertSize
);
if
(
m_transform
!=
NULL
)
{
// Apply transformations
...
...
@@ -83,9 +80,17 @@ void VBO_ITEM::PushVertex( const GLfloat* aVertex )
glm
::
vec4
transVertex
=
*
m_transform
*
origVertex
;
// Replace only coordinates, leave color as it is
memcpy
(
m_vertPtr
,
&
transVertex
[
0
],
3
*
sizeof
(
GLfloat
)
);
memcpy
(
m_vertPtr
,
&
transVertex
[
0
],
CoordSize
);
}
else
{
// Add the new vertex
memcpy
(
m_vertPtr
,
aVertex
,
CoordSize
);
}
// Apply currently used color
memcpy
(
m_vertPtr
+
ColorOffset
,
m_color
,
ColorSize
);
// Move to the next free space
m_vertPtr
+=
VertStride
;
...
...
@@ -180,7 +185,6 @@ void VBO_ITEM::ChangeColor( const COLOR4D& aColor )
}
// TODO it is not used yet
void
VBO_ITEM
::
UseColor
(
const
COLOR4D
&
aColor
)
{
m_color
[
0
]
=
aColor
.
r
;
...
...
include/gal/opengl/opengl_gal.h
View file @
7a1718d0
...
...
@@ -506,6 +506,26 @@ private:
inline
void
drawLineCap
(
const
VECTOR2D
&
aStartPoint
,
const
VECTOR2D
&
aEndPoint
,
double
aDepthOffset
);
///< OpenGL replacement functions (that are working both in immediate and VBO modes)
/**
* @brief Starts drawing in immediate mode or does nothing if an item's caching has started.
* @param aMode specifies the primitive or primitives that will be created.
*/
inline
void
begin
(
GLenum
aMode
);
/**
* @brief Ends drawing in immediate mode or does nothing if an item's caching has started.
*/
inline
void
end
();
/**
* @brief Adds vertex to the current item or draws it in immediate mode.
* @param aX is X coordinate.
* @param aY is Y coordinate.
* @param aZ is Z coordinate.
*/
inline
void
vertex3
(
double
aX
,
double
aY
,
double
aZ
);
/**
* @brief Function that replaces glTranslate and behaves according to isGrouping variable.
* In case isGrouping==false, it is simply glTranslate, in other case it
...
...
include/gal/opengl/vbo_item.h
View file @
7a1718d0
...
...
@@ -130,8 +130,8 @@ public:
static
const
int
VertStride
=
7
;
static
const
int
VertSize
=
VertStride
*
sizeof
(
GLfloat
);
static
const
int
IndStride
=
1
;
static
const
int
IndSize
=
IndStride
*
sizeof
(
GLuin
t
);
static
const
int
CoordStride
=
3
;
static
const
int
CoordSize
=
CoordStride
*
sizeof
(
GLfloa
t
);
// Offset of color data from the beginning of each vertex data
static
const
int
ColorOffset
=
3
;
...
...
@@ -139,6 +139,9 @@ public:
static
const
int
ColorStride
=
4
;
static
const
int
ColorSize
=
ColorStride
*
sizeof
(
GLfloat
);
static
const
int
IndStride
=
1
;
static
const
int
IndSize
=
IndStride
*
sizeof
(
GLuint
);
private
:
///< VBO ids in which the item is stored.
//int m_vboId; // not used yet
...
...
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