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
00847a8a
Commit
00847a8a
authored
Jun 30, 2013
by
Maciej Sumiński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Colors are stored as unsigned bytes instead of floats.
parent
27a6f8af
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
18 deletions
+18
-18
opengl_gal.cpp
common/gal/opengl/opengl_gal.cpp
+1
-1
vbo_item.cpp
common/gal/opengl/vbo_item.cpp
+4
-4
vbo_container.h
include/gal/opengl/vbo_container.h
+10
-10
vbo_item.h
include/gal/opengl/vbo_item.h
+3
-3
No files found.
common/gal/opengl/opengl_gal.cpp
View file @
00847a8a
...
@@ -511,7 +511,7 @@ void OPENGL_GAL::EndDrawing()
...
@@ -511,7 +511,7 @@ void OPENGL_GAL::EndDrawing()
// Bind vertices data buffers
// Bind vertices data buffers
glBindBuffer
(
GL_ARRAY_BUFFER
,
vboVertices
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
vboVertices
);
glVertexPointer
(
VBO_ITEM
::
CoordStride
,
GL_FLOAT
,
VBO_ITEM
::
VertByteSize
,
0
);
glVertexPointer
(
VBO_ITEM
::
CoordStride
,
GL_FLOAT
,
VBO_ITEM
::
VertByteSize
,
0
);
glColorPointer
(
VBO_ITEM
::
ColorStride
,
GL_
FLOAT
,
VBO_ITEM
::
VertByteSize
,
glColorPointer
(
VBO_ITEM
::
ColorStride
,
GL_
UNSIGNED_BYTE
,
VBO_ITEM
::
VertByteSize
,
(
GLvoid
*
)
VBO_ITEM
::
ColorByteOffset
);
(
GLvoid
*
)
VBO_ITEM
::
ColorByteOffset
);
// Shader parameters
// Shader parameters
...
...
common/gal/opengl/vbo_item.cpp
View file @
00847a8a
...
@@ -83,10 +83,10 @@ void VBO_ITEM::ChangeColor( const COLOR4D& aColor )
...
@@ -83,10 +83,10 @@ void VBO_ITEM::ChangeColor( const COLOR4D& aColor )
for
(
unsigned
int
i
=
0
;
i
<
m_size
;
++
i
)
for
(
unsigned
int
i
=
0
;
i
<
m_size
;
++
i
)
{
{
vertexPtr
->
r
=
aColor
.
r
;
vertexPtr
->
r
=
aColor
.
r
*
255
;
vertexPtr
->
g
=
aColor
.
g
;
vertexPtr
->
g
=
aColor
.
g
*
255
;
vertexPtr
->
b
=
aColor
.
b
;
vertexPtr
->
b
=
aColor
.
b
*
255
;
vertexPtr
->
a
=
aColor
.
a
;
vertexPtr
->
a
=
aColor
.
a
*
255
;
// Move on to the next vertex
// Move on to the next vertex
vertexPtr
++
;
vertexPtr
++
;
...
...
include/gal/opengl/vbo_container.h
View file @
00847a8a
...
@@ -150,10 +150,10 @@ public:
...
@@ -150,10 +150,10 @@ public:
*/
*/
inline
void
UseColor
(
const
COLOR4D
&
aColor
)
inline
void
UseColor
(
const
COLOR4D
&
aColor
)
{
{
m_color
[
0
]
=
aColor
.
r
;
m_color
[
0
]
=
aColor
.
r
*
255
;
m_color
[
1
]
=
aColor
.
g
;
m_color
[
1
]
=
aColor
.
g
*
255
;
m_color
[
2
]
=
aColor
.
b
;
m_color
[
2
]
=
aColor
.
b
*
255
;
m_color
[
3
]
=
aColor
.
a
;
m_color
[
3
]
=
aColor
.
a
*
255
;
}
}
/**
/**
...
@@ -165,7 +165,7 @@ public:
...
@@ -165,7 +165,7 @@ public:
{
{
for
(
unsigned
int
i
=
0
;
i
<
VBO_ITEM
::
ColorStride
;
++
i
)
for
(
unsigned
int
i
=
0
;
i
<
VBO_ITEM
::
ColorStride
;
++
i
)
{
{
m_color
[
i
]
=
aColor
[
i
];
m_color
[
i
]
=
aColor
[
i
]
*
255
;
}
}
}
}
...
@@ -179,10 +179,10 @@ public:
...
@@ -179,10 +179,10 @@ public:
*/
*/
inline
void
UseColor
(
GLfloat
aR
,
GLfloat
aG
,
GLfloat
aB
,
GLfloat
aA
)
inline
void
UseColor
(
GLfloat
aR
,
GLfloat
aG
,
GLfloat
aB
,
GLfloat
aA
)
{
{
m_color
[
0
]
=
aR
;
m_color
[
0
]
=
aR
*
255
;
m_color
[
1
]
=
aG
;
m_color
[
1
]
=
aG
*
255
;
m_color
[
2
]
=
aB
;
m_color
[
2
]
=
aB
*
255
;
m_color
[
3
]
=
aA
;
m_color
[
3
]
=
aA
*
255
;
}
}
/**
/**
...
@@ -318,7 +318,7 @@ private:
...
@@ -318,7 +318,7 @@ private:
VBO_ITEM
*
item
;
VBO_ITEM
*
item
;
///< Color used for new vertices pushed.
///< Color used for new vertices pushed.
GL
float
m_color
[
VBO_ITEM
::
ColorStride
];
GL
ubyte
m_color
[
VBO_ITEM
::
ColorStride
];
///< Shader and its parameters used for new vertices pushed
///< Shader and its parameters used for new vertices pushed
GLfloat
m_shader
[
VBO_ITEM
::
ShaderStride
];
GLfloat
m_shader
[
VBO_ITEM
::
ShaderStride
];
...
...
include/gal/opengl/vbo_item.h
View file @
00847a8a
...
@@ -39,7 +39,7 @@ namespace KiGfx
...
@@ -39,7 +39,7 @@ namespace KiGfx
typedef
struct
VBO_VERTEX
typedef
struct
VBO_VERTEX
{
{
GLfloat
x
,
y
,
z
;
// Coordinates
GLfloat
x
,
y
,
z
;
// Coordinates
GL
float
r
,
g
,
b
,
a
;
// Color
GL
ubyte
r
,
g
,
b
,
a
;
// Color
GLfloat
shader
[
4
];
// Shader type & params
GLfloat
shader
[
4
];
// Shader type & params
}
VBO_VERTEX
;
}
VBO_VERTEX
;
...
@@ -136,10 +136,10 @@ public:
...
@@ -136,10 +136,10 @@ public:
// Offset of color data from the beginning of each vertex data
// Offset of color data from the beginning of each vertex data
static
const
unsigned
int
ColorByteOffset
=
offsetof
(
VBO_VERTEX
,
r
);
static
const
unsigned
int
ColorByteOffset
=
offsetof
(
VBO_VERTEX
,
r
);
static
const
unsigned
int
ColorOffset
=
ColorByteOffset
/
sizeof
(
GL
float
);
static
const
unsigned
int
ColorOffset
=
ColorByteOffset
/
sizeof
(
GL
ubyte
);
static
const
unsigned
int
ColorByteSize
=
sizeof
(
VBO_VERTEX
().
r
)
+
sizeof
(
VBO_VERTEX
().
g
)
+
static
const
unsigned
int
ColorByteSize
=
sizeof
(
VBO_VERTEX
().
r
)
+
sizeof
(
VBO_VERTEX
().
g
)
+
sizeof
(
VBO_VERTEX
().
b
)
+
sizeof
(
VBO_VERTEX
().
a
);
sizeof
(
VBO_VERTEX
().
b
)
+
sizeof
(
VBO_VERTEX
().
a
);
static
const
unsigned
int
ColorStride
=
ColorByteSize
/
sizeof
(
GL
float
);
static
const
unsigned
int
ColorStride
=
ColorByteSize
/
sizeof
(
GL
ubyte
);
// Shader attributes
// Shader attributes
static
const
unsigned
int
ShaderByteOffset
=
offsetof
(
VBO_VERTEX
,
shader
);
static
const
unsigned
int
ShaderByteOffset
=
offsetof
(
VBO_VERTEX
,
shader
);
...
...
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