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
fbc3d63c
Commit
fbc3d63c
authored
Jun 24, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Draw the origin marker in OpenGL with shaders GAL.
parent
978b548c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
33 deletions
+21
-33
graphics_abstraction_layer.cpp
common/gal/graphics_abstraction_layer.cpp
+3
-4
opengl_gal.cpp
common/gal/opengl/opengl_gal.cpp
+18
-28
opengl_gal.h
include/gal/opengl/opengl_gal.h
+0
-1
No files found.
common/gal/graphics_abstraction_layer.cpp
View file @
fbc3d63c
...
...
@@ -97,13 +97,12 @@ void GAL::DrawGrid()
double
width
=
gridLineWidth
/
worldScale
;
double
doubleWidth
=
2
*
width
;
// Set line width & color
SetLineWidth
(
width
);
double
origSize
=
(
double
)
gridOriginMarkerSize
/
worldScale
;
SetLayerDepth
(
0.0
);
// Draw the origin marker
double
origSize
=
(
double
)
gridOriginMarkerSize
/
worldScale
;
SetStrokeColor
(
COLOR4D
(
1.0
,
1.0
,
1.0
,
1.0
)
);
SetLineWidth
(
width
);
SetIsFill
(
false
);
DrawLine
(
gridOrigin
+
VECTOR2D
(
-
origSize
,
-
origSize
),
gridOrigin
+
VECTOR2D
(
origSize
,
origSize
)
);
DrawLine
(
gridOrigin
+
VECTOR2D
(
-
origSize
,
origSize
),
gridOrigin
+
VECTOR2D
(
origSize
,
-
origSize
)
);
...
...
common/gal/opengl/opengl_gal.cpp
View file @
fbc3d63c
...
...
@@ -113,20 +113,18 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
InitTesselatorCallbacks
(
tesselator
);
gluTessProperty
(
tesselator
,
GLU_TESS_WINDING_RULE
,
GLU_TESS_WINDING_POSITIVE
);
if
(
!
isUseShader
)
{
// (3 vertices per triangle) * (2 items [circle&semicircle]) * (number of points per item)
precomputedContainer
=
new
VBO_CONTAINER
(
3
*
2
*
CIRCLE_POINTS
);
// Compute the unit circles, used for speed up of the circle drawing
verticesCircle
=
new
VBO_ITEM
(
precomputedContainer
);
computeUnitCircle
();
verticesCircle
->
Finish
();
verticesSemiCircle
=
new
VBO_ITEM
(
precomputedContainer
);
computeUnitSemiCircle
();
verticesSemiCircle
->
Finish
();
}
// Buffered semicircle & circle vertices
// (3 vertices per triangle) * (2 items [circle&semicircle]) * (number of points per item)
precomputedContainer
=
new
VBO_CONTAINER
(
3
*
2
*
CIRCLE_POINTS
);
// Compute the unit circles, used for speed up of the circle drawing
verticesCircle
=
new
VBO_ITEM
(
precomputedContainer
);
computeUnitCircle
();
verticesCircle
->
Finish
();
verticesSemiCircle
=
new
VBO_ITEM
(
precomputedContainer
);
computeUnitSemiCircle
();
verticesSemiCircle
->
Finish
();
}
...
...
@@ -134,12 +132,9 @@ OPENGL_GAL::~OPENGL_GAL()
{
glFlush
();
if
(
!
isUseShader
)
{
delete
verticesCircle
;
delete
verticesSemiCircle
;
delete
precomputedContainer
;
}
delete
verticesCircle
;
delete
verticesSemiCircle
;
delete
precomputedContainer
;
// Delete the buffers
if
(
isFrameBufferInitialized
)
...
...
@@ -449,8 +444,6 @@ void OPENGL_GAL::BeginDrawing()
void
OPENGL_GAL
::
blitMainTexture
(
bool
aIsClearFrameBuffer
)
{
shader
.
Deactivate
();
// Don't use blending for the final blitting
glDisable
(
GL_BLEND
);
...
...
@@ -606,7 +599,7 @@ inline void OPENGL_GAL::drawLineQuad( const VECTOR2D& aStartPoint, const VECTOR2
begin
(
GL_TRIANGLES
);
if
(
isUseShader
)
if
(
isUseShader
&&
isGrouping
)
{
glm
::
vec4
vector
(
perpendicularVector
.
x
,
perpendicularVector
.
y
,
0.0
,
0.0
);
...
...
@@ -1026,7 +1019,7 @@ void OPENGL_GAL::DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEn
void
OPENGL_GAL
::
DrawCircle
(
const
VECTOR2D
&
aCenterPoint
,
double
aRadius
)
{
if
(
isUseShader
)
if
(
isUseShader
&&
isGrouping
)
{
if
(
isFillEnabled
)
{
...
...
@@ -1161,7 +1154,7 @@ void OPENGL_GAL::DrawCircle( const VECTOR2D& aCenterPoint, double aRadius )
void
OPENGL_GAL
::
drawSemiCircle
(
const
VECTOR2D
&
aCenterPoint
,
double
aRadius
,
double
aAngle
)
{
if
(
isUseShader
)
if
(
isUseShader
&&
isGrouping
)
{
Save
();
Translate
(
aCenterPoint
);
...
...
@@ -1924,9 +1917,6 @@ void OPENGL_GAL::DrawGridLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEnd
VECTOR2D
point3
=
aEndPoint
+
perpendicularVector
;
VECTOR2D
point4
=
aEndPoint
-
perpendicularVector
;
if
(
isUseShader
)
shader
.
Deactivate
();
// Set color
glColor4d
(
gridColor
.
r
,
gridColor
.
g
,
gridColor
.
b
,
gridColor
.
a
);
...
...
include/gal/opengl/opengl_gal.h
View file @
fbc3d63c
...
...
@@ -409,7 +409,6 @@ private:
bool
isFrameBufferInitialized
;
///< Are the frame buffers initialized?
bool
isVboInitialized
;
bool
isShaderInitialized
;
///< Was the shader initialized?
bool
isShaderEnabled
;
///< Are the shaders enabled?
bool
isUseShader
;
///< Should the shaders be used?
bool
isGrouping
;
///< Was a group started?
...
...
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