summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorPeilin <peilin@multicorewareinc.com>2014-03-03 16:15:29 +0800
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-03-04 21:34:26 +0100
commit1c8fb3bd1137c1ab922b840bef5748abbbe6531e (patch)
tree4cc867778fd6ed9fd8773a0ec3b62e401b391d78 /chart2
parent62d6252d2cde33f6ef0e627c3192a63d43ba2a87 (diff)
add black bubble edge and modify transparence
Change-Id: If18e74c2cec00d29bddaffbbd21991749490493a
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/view/main/DummyXShape.cxx7
-rwxr-xr-xchart2/source/view/main/OpenGLRender.cxx30
-rwxr-xr-xchart2/source/view/main/OpenGLRender.hxx4
3 files changed, 38 insertions, 3 deletions
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index 8d4ac25efb2a..036b306c6a53 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -514,6 +514,13 @@ void DummyCircle::render()
else
SAL_WARN("chart2.opengl", "missing color");
+ itr = maProperties.find("FillTransparence");
+ if(itr != maProperties.end())
+ {
+ sal_Int32 nTrans = itr->second.get<sal_Int32>();
+ pChart->m_GLRender.SetTransparency(nTrans&0xFF);
+ }
+
pChart->m_GLRender.Bubble2DShapePoint(maPosition.X, maPosition.Y,
maSize.Width, maSize.Height);
pChart->m_GLRender.RenderBubble2FBO(GL_TRUE);
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index bf7bcdd67225..396ac94c4a76 100755
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -1044,6 +1044,7 @@ int OpenGLRender::Bubble2DShapePoint(float x, float y, float directionX, float d
int OpenGLRender::RenderBubble2FBO(int)
{
CHECK_GL_ERROR();
+ glm::vec4 edgeColor = glm::vec4(0.0, 0.0, 0.0, 1.0);
size_t listNum = m_Bubble2DShapePointList.size();
for (size_t i = 0; i < listNum; i++)
{
@@ -1082,7 +1083,30 @@ int OpenGLRender::RenderBubble2FBO(int)
glDrawArrays(GL_TRIANGLE_FAN, 0, m_Bubble2DCircle.size() / 2);
glDisableVertexAttribArray(m_2DVertexID);
glUseProgram(0);
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+ //add black edge
+ glLineWidth(3.0);
+ glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
+ glBufferData(GL_ARRAY_BUFFER, m_Bubble2DCircle.size() * sizeof(GLfloat) -2 , &m_Bubble2DCircle[2], GL_STATIC_DRAW);
+ glUseProgram(m_CommonProID);
+ glUniform4fv(m_2DColorID, 1, &edgeColor[0]);
+ glUniformMatrix4fv(m_MatrixID, 1, GL_FALSE, &m_MVP[0][0]);
+ glEnableVertexAttribArray(m_2DVertexID);
+ glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
+ glVertexAttribPointer(
+ m_2DVertexID, // attribute. No particular reason for 0, but must match the layout in the shader.
+ 2, // size
+ GL_FLOAT, // type
+ GL_FALSE, // normalized?
+ 0, // stride
+ (void*)0 // array buffer offset
+ );
+ glDrawArrays(GL_LINE_STRIP, 0, (m_Bubble2DCircle.size() * sizeof(GLfloat) -2) / sizeof(float) / 2);
+ glDisableVertexAttribArray(m_2DVertexID);
+ glUseProgram(0);
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
m_Bubble2DShapePointList.pop_front();
+ glLineWidth(m_fLineWidth);
}
//if use MSAA, we should copy the data to the FBO texture
GLenum fbResult = glCheckFramebufferStatus(GL_FRAMEBUFFER);
@@ -1528,7 +1552,11 @@ void OpenGLRender::SetChartTransparencyGradient(long transparencyGradient)
m_BackgroundColor[15] = 0.0;
}
}
-
+void OpenGLRender::SetTransparency(sal_uInt32 transparency)
+{
+ m_fAlpha = (float)transparency / 255.0;
+ m_2DColor = glm::vec4(m_2DColor.r, m_2DColor.g, m_2DColor.b, m_fAlpha);
+}
void OpenGLRender::GeneratePieSegment2D(double fInnerRadius, double fOutterRadius, double nAngleStart, double nAngleWidth)
{
double nAngleStep = 1;
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
index 09e0778e7995..ab1da1ecd7dd 100755
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -191,7 +191,7 @@ public:
#endif
void SetBackGroundColor(sal_uInt32 color1, sal_uInt32 color2, sal_uInt8 nAlpha);
-
+ void SetTransparency(sal_uInt32 transparency);
private:
GLint LoadShaders(const OUString& rVertexShaderName, const OUString& rFragmentShaderName);
int CreateTextureObj(int width, int height);
@@ -294,7 +294,7 @@ private:
GLuint m_DebugVertexID;
GLuint m_DebugColorID;
#endif
-
+ float m_fAlpha;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */