diff options
-rw-r--r-- | chart2/source/view/main/DummyXShape.cxx | 521 | ||||
-rwxr-xr-x | chart2/source/view/main/OpenGLRender.cxx | 74 | ||||
-rwxr-xr-x | chart2/source/view/main/OpenGLRender.hxx | 8 |
3 files changed, 39 insertions, 564 deletions
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx index 4779c0f345ca..6b18a2fb3902 100644 --- a/chart2/source/view/main/DummyXShape.cxx +++ b/chart2/source/view/main/DummyXShape.cxx @@ -459,509 +459,8 @@ DummySymbol2D::DummySymbol2D(const drawing::Position3D& rPos, const drawing::Dir mnBorderColor(nBorderColor), mnFillColor(nFillColor) { - //setPosition(Position3DToAWTPoint(rPos)); - //setSize(Direction3DToAWTSize(rSize)); -} -drawing::PolyPolygonShape3D oglCreatePolyPolygon_Symbol( const drawing::Position3D& rPos - , const drawing::Direction3D& rSize - , sal_Int32 nStandardSymbol ) -{ - printf("*** createPolyPolygon_Symbol\n"); - if(nStandardSymbol<0) - nStandardSymbol*=-1; - nStandardSymbol = nStandardSymbol%Symbol_COUNT; - SymbolEnum eSymbolType=static_cast<SymbolEnum>(nStandardSymbol); - - const double& fX = rPos.PositionX; - const double& fY = rPos.PositionY; - - const double fWidthH = rSize.DirectionX/2.0; //fWidthH stands for Half Width - const double fHeightH = rSize.DirectionY/2.0; //fHeightH stands for Half Height - - const sal_Int32 nQuarterCount = 35; // points inside a quadrant, used in case circle - - sal_Int32 nPointCount = 4; //all arrow symbols only need 4 points - switch( eSymbolType ) - { - case Symbol_Square: - case Symbol_Diamond: - case Symbol_Bowtie: - case Symbol_Sandglass: - case Symbol_HorizontalBar: - case Symbol_VerticalBar: - nPointCount = 5; - break; - case Symbol_X: - nPointCount = 13; - break; - case Symbol_Plus: - nPointCount = 13; - break; - case Symbol_Star: - nPointCount = 9; - break; - case Symbol_Asterisk: - nPointCount = 19; - break; - case Symbol_Circle: - nPointCount = 5 + 4 * nQuarterCount; - break; - default: - break; - } - - drawing::PolyPolygonShape3D aPP; - - aPP.SequenceX.realloc(1); - aPP.SequenceY.realloc(1); - aPP.SequenceZ.realloc(1); - - drawing::DoubleSequence* pOuterSequenceX = aPP.SequenceX.getArray(); - drawing::DoubleSequence* pOuterSequenceY = aPP.SequenceY.getArray(); - drawing::DoubleSequence* pOuterSequenceZ = aPP.SequenceZ.getArray(); - - pOuterSequenceX->realloc(nPointCount); - pOuterSequenceY->realloc(nPointCount); - pOuterSequenceZ->realloc(nPointCount); - - double* pInnerSequenceX = pOuterSequenceX->getArray(); - double* pInnerSequenceY = pOuterSequenceY->getArray(); - double* pInnerSequenceZ = pOuterSequenceZ->getArray(); - - for(sal_Int32 nN = nPointCount; nN--;) - *pInnerSequenceZ++ = 0.0; - - switch(eSymbolType) - { - case Symbol_Square: - { - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY-fHeightH; - - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY+fHeightH; - - *pInnerSequenceX++ = fX+fWidthH; - *pInnerSequenceY++ = fY+fHeightH; - - *pInnerSequenceX++ = fX+fWidthH; - *pInnerSequenceY++ = fY-fHeightH; - - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY-fHeightH; - break; - } - case Symbol_UpArrow: - { - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY+fHeightH; - - *pInnerSequenceX++ = fX+fWidthH; - *pInnerSequenceY++ = fY+fHeightH; - - *pInnerSequenceX++ = fX; - *pInnerSequenceY++ = fY-fHeightH; - - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY+fHeightH; - break; - } - case Symbol_DownArrow: - { - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY-fHeightH; - - *pInnerSequenceX++ = fX; - *pInnerSequenceY++ = fY+fHeightH; - - *pInnerSequenceX++ = fX+fWidthH; - *pInnerSequenceY++ = fY-fHeightH; - - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY-fHeightH; - break; - } - case Symbol_RightArrow: - { - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY-fHeightH; - - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY+fHeightH; - - *pInnerSequenceX++ = fX+fWidthH; - *pInnerSequenceY++ = fY; - - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY-fHeightH; - break; - } - case Symbol_LeftArrow: - { - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY; - - *pInnerSequenceX++ = fX+fWidthH; - *pInnerSequenceY++ = fY+fHeightH; - - *pInnerSequenceX++ = fX+fWidthH; - *pInnerSequenceY++ = fY-fHeightH; - - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY; - break; - } - case Symbol_Bowtie: - { - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY-fHeightH; - - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY+fHeightH; - - *pInnerSequenceX++ = fX+fWidthH; - *pInnerSequenceY++ = fY-fHeightH; - - *pInnerSequenceX++ = fX+fWidthH; - *pInnerSequenceY++ = fY+fHeightH; - - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY-fHeightH; - break; - } - case Symbol_Sandglass: - { - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY+fHeightH; - - *pInnerSequenceX++ = fX+fWidthH; - *pInnerSequenceY++ = fY+fHeightH; - - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY-fHeightH; - - *pInnerSequenceX++ = fX+fWidthH; - *pInnerSequenceY++ = fY-fHeightH; - - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY+fHeightH; - break; - } - case Symbol_Diamond: - { - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY; - - *pInnerSequenceX++ = fX; - *pInnerSequenceY++ = fY+fHeightH; - - *pInnerSequenceX++ = fX+fWidthH; - *pInnerSequenceY++ = fY; - - *pInnerSequenceX++ = fX; - *pInnerSequenceY++ = fY-fHeightH; - - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY; - break; - } - case Symbol_HorizontalBar: - { - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY-0.2*fHeightH; - - *pInnerSequenceX++ = fX+fWidthH; - *pInnerSequenceY++ = fY-0.2*fHeightH; - - *pInnerSequenceX++ = fX+fWidthH; - *pInnerSequenceY++ = fY+0.2*fHeightH; - - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY+0.2*fHeightH; - - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY-0.2*fHeightH; - break; - } - case Symbol_VerticalBar: - { - *pInnerSequenceX++ = fX-0.2*fWidthH; - *pInnerSequenceY++ = fY-fHeightH; - - *pInnerSequenceX++ = fX+0.2*fWidthH; - *pInnerSequenceY++ = fY-fHeightH; - - *pInnerSequenceX++ = fX+0.2*fWidthH; - *pInnerSequenceY++ = fY+fHeightH; - - *pInnerSequenceX++ = fX-0.2*fWidthH; - *pInnerSequenceY++ = fY+fHeightH; - - *pInnerSequenceX++ = fX-0.2*fWidthH; - *pInnerSequenceY++ = fY-fHeightH; - - break; - } - case Symbol_Circle: - { - double fOmega = 1.5707963267948966192 / (nQuarterCount + 1.0); - // one point in the middle of each edge to get full size bounding rectangle - *pInnerSequenceX++ = fX + fWidthH; - *pInnerSequenceY++ = fY; - // 0 to PI/2 - for (sal_Int32 i = 1; i <= nQuarterCount; ++i) - { - *pInnerSequenceX++ = fX + fWidthH * cos( i * fOmega ); - *pInnerSequenceY++ = fY - fHeightH * sin( i * fOmega ); - } - // PI/2 to PI - *pInnerSequenceX++ = fX; - *pInnerSequenceY++ = fY - fHeightH; - for (sal_Int32 i = 1; i <= nQuarterCount; ++i) - { - *pInnerSequenceX++ = fX - fWidthH * sin( i * fOmega); - *pInnerSequenceY++ = fY - fHeightH * cos( i * fOmega); - } - // PI to 3/2*PI - *pInnerSequenceX++ = fX - fWidthH; - *pInnerSequenceY++ = fY; - for (sal_Int32 i = 1; i <= nQuarterCount; ++i) - { - *pInnerSequenceX++ = fX - fWidthH * cos( i * fOmega); - *pInnerSequenceY++ = fY + fHeightH * sin( i * fOmega); - } - // 3/2*PI to 2*PI - *pInnerSequenceX++ = fX; - *pInnerSequenceY++ = fY + fHeightH; - for (sal_Int32 i = 1; i <= nQuarterCount; ++i) - { - *pInnerSequenceX++ = fX + fWidthH * sin(i * fOmega); - *pInnerSequenceY++ = fY + fHeightH * cos(i * fOmega); - } - // close polygon - *pInnerSequenceX++ = fX + fWidthH; - *pInnerSequenceY++ = fY; - break; - } - case Symbol_Star: - { - *pInnerSequenceX++ = fX; - *pInnerSequenceY++ = fY-fHeightH; - - *pInnerSequenceX++ = fX+0.2*fWidthH; - *pInnerSequenceY++ = fY-0.2*fHeightH; - - *pInnerSequenceX++ = fX+fWidthH; - *pInnerSequenceY++ = fY; - - *pInnerSequenceX++ = fX+0.2*fWidthH; - *pInnerSequenceY++ = fY+0.2*fHeightH; - - *pInnerSequenceX++ = fX; - *pInnerSequenceY++ = fY+fHeightH; - - *pInnerSequenceX++ = fX-0.2*fWidthH; - *pInnerSequenceY++ = fY+0.2*fHeightH; - - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY; - - *pInnerSequenceX++ = fX-0.2*fWidthH; - *pInnerSequenceY++ = fY-0.2*fHeightH; - - *pInnerSequenceX++ = fX; - *pInnerSequenceY++ = fY-fHeightH; - break; - } - case Symbol_X: - { - const double fScaleX = fWidthH / 128.0; - const double fScaleY = fHeightH / 128.0; - const double fSmall = sqrt(200.0); - const double fLarge = 128.0 - fSmall; - - *pInnerSequenceX++ = fX; - *pInnerSequenceY++ = fY - fScaleY * fSmall; - - *pInnerSequenceX++ = fX - fScaleX * fLarge; - *pInnerSequenceY++ = fY - fHeightH; - - *pInnerSequenceX++ = fX - fWidthH; - *pInnerSequenceY++ = fY - fScaleY * fLarge; - - *pInnerSequenceX++ = fX - fScaleX * fSmall; - *pInnerSequenceY++ = fY; - - *pInnerSequenceX++ = fX - fWidthH; - *pInnerSequenceY++ = fY + fScaleY * fLarge; - - *pInnerSequenceX++ = fX - fScaleX * fLarge; - *pInnerSequenceY++ = fY + fHeightH; - - *pInnerSequenceX++ = fX; - *pInnerSequenceY++ = fY + fScaleY * fSmall; - - *pInnerSequenceX++ = fX + fScaleX * fLarge; - *pInnerSequenceY++ = fY + fHeightH; - - *pInnerSequenceX++ = fX + fWidthH; - *pInnerSequenceY++ = fY + fScaleY * fLarge; - - *pInnerSequenceX++ = fX + fScaleX * fSmall; - *pInnerSequenceY++ = fY; - - *pInnerSequenceX++ = fX + fWidthH; - *pInnerSequenceY++ = fY - fScaleY * fLarge; - - *pInnerSequenceX++ = fX + fScaleX * fLarge; - *pInnerSequenceY++ = fY - fHeightH; - - *pInnerSequenceX++ = fX; - *pInnerSequenceY++ = fY - fScaleY * fSmall; - break; - - } - case Symbol_Plus: - { - const double fScaleX = fWidthH / 128.0; - const double fScaleY = fHeightH / 128.0; - const double fHalf = 10.0; //half line width on 256 size square - const double fdX = fScaleX * fHalf; - const double fdY = fScaleY * fHalf; - - *pInnerSequenceX++ = fX-fdX; - *pInnerSequenceY++ = fY-fHeightH; - - *pInnerSequenceX++ = fX-fdX; - *pInnerSequenceY++ = fY-fdY; - - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY-fdY; - - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY+fdY; - - *pInnerSequenceX++ = fX-fdX; - *pInnerSequenceY++ = fY+fdY; - - *pInnerSequenceX++ = fX-fdX; - *pInnerSequenceY++ = fY+fHeightH; - - *pInnerSequenceX++ = fX+fdX; - *pInnerSequenceY++ = fY+fHeightH; - - *pInnerSequenceX++ = fX+fdX; - *pInnerSequenceY++ = fY+fdY; - - *pInnerSequenceX++ = fX+fWidthH; - *pInnerSequenceY++ = fY+fdY; - - *pInnerSequenceX++ = fX+fWidthH; - *pInnerSequenceY++ = fY-fdY; - - *pInnerSequenceX++ = fX+fdX; - *pInnerSequenceY++ = fY-fdY; - - *pInnerSequenceX++ = fX+fdY; - *pInnerSequenceY++ = fY-fHeightH; - - *pInnerSequenceX++ = fX-fdX; - *pInnerSequenceY++ = fY-fHeightH; - break; - - } - case Symbol_Asterisk: - { - const double fHalf = 10.0; // half line width on 256 size square - const double fTwoY = fHalf * sqrt(3.0); - const double fFourY = (128.0 - 2.0 * fHalf ) / sqrt(3.0); - const double fThreeX = 128.0 - fHalf; - const double fThreeY = fHalf * sqrt(3.0) + fFourY; - const double fFiveX = 2.0 * fHalf; - - const double fScaleX = fWidthH / 128.0; - const double fScaleY = fHeightH / 128.0; - - //1 - *pInnerSequenceX++ = fX-fScaleX * fHalf; - *pInnerSequenceY++ = fY-fHeightH; - //2 - *pInnerSequenceX++ = fX-fScaleX * fHalf; - *pInnerSequenceY++ = fY-fScaleY * fTwoY; - //3 - *pInnerSequenceX++ = fX-fScaleX * fThreeX; - *pInnerSequenceY++ = fY-fScaleY * fThreeY; - //4 - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY-fScaleY * fFourY; - //5 - *pInnerSequenceX++ = fX-fScaleX * fFiveX; - *pInnerSequenceY++ = fY; - //6 as 4 - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY+fScaleY * fFourY; - //7 as 3 - *pInnerSequenceX++ = fX-fScaleX * fThreeX; - *pInnerSequenceY++ = fY+fScaleY * fThreeY; - //8 as 2 - *pInnerSequenceX++ = fX-fScaleX * fHalf; - *pInnerSequenceY++ = fY+fScaleY * fTwoY; - //9 as 1 - *pInnerSequenceX++ = fX-fScaleX * fHalf; - *pInnerSequenceY++ = fY+fHeightH; - //10 as 1 - *pInnerSequenceX++ = fX+fScaleX * fHalf; - *pInnerSequenceY++ = fY+fHeightH; - //11 as 2 - *pInnerSequenceX++ = fX+fScaleX * fHalf; - *pInnerSequenceY++ = fY+fScaleY * fTwoY; - //12 as 3 - *pInnerSequenceX++ = fX+fScaleX * fThreeX; - *pInnerSequenceY++ = fY+fScaleY * fThreeY; - //13 as 4 - *pInnerSequenceX++ = fX+fWidthH; - *pInnerSequenceY++ = fY+fScaleY * fFourY; - //14 as 5 - *pInnerSequenceX++ = fX+fScaleX * fFiveX; - *pInnerSequenceY++ = fY; - //15 as 4 - *pInnerSequenceX++ = fX+fWidthH; - *pInnerSequenceY++ = fY-fScaleY * fFourY; - //16 as 3 - *pInnerSequenceX++ = fX+fScaleX * fThreeX; - *pInnerSequenceY++ = fY-fScaleY * fThreeY; - //17 as 2 - *pInnerSequenceX++ = fX+fScaleX * fHalf; - *pInnerSequenceY++ = fY-fScaleY * fTwoY; - // 18 as 1 - *pInnerSequenceX++ = fX+fScaleX * fHalf; - *pInnerSequenceY++ = fY-fHeightH; - // 19 = 1, closing - *pInnerSequenceX++ = fX-fScaleX * fHalf; - *pInnerSequenceY++ = fY-fHeightH; - break; - } - default: //case Symbol_Square: - { - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY-fHeightH; - - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY+fHeightH; - - *pInnerSequenceX++ = fX+fWidthH; - *pInnerSequenceY++ = fY+fHeightH; - - *pInnerSequenceX++ = fX+fWidthH; - *pInnerSequenceY++ = fY-fHeightH; - - *pInnerSequenceX++ = fX-fWidthH; - *pInnerSequenceY++ = fY-fHeightH; - break; - } - } - - return aPP; + setPosition(Position3DToAWTPoint(rPos)); + setSize(Direction3DToAWTSize(rSize)); } void DummySymbol2D::render() @@ -970,21 +469,7 @@ void DummySymbol2D::render() pChart->m_GLRender.SetColor(mnFillColor); - drawing::PointSequenceSequence aPointss( PolyToPointSequence( - oglCreatePolyPolygon_Symbol( mrPosition, mrSize, mnStandardSymbol ) )); - - sal_Int32 nPointssCount = aPointss.getLength(); - for(sal_Int32 i = 0; i < nPointssCount; i++) - { - const com::sun::star::uno::Sequence<com::sun::star::awt::Point>& points = aPointss[i]; - sal_Int32 nPointsCount = points.getLength(); - for(sal_Int32 j = 0; j < nPointsCount; j++) - { - const com::sun::star::awt::Point& p = points[j]; - pChart->m_GLRender.SetSymbol2DShapePoint((float)p.X, (float)p.Y, nPointsCount); - } - } - pChart->m_GLRender.RenderSymbol2DShape(); + pChart->m_GLRender.RenderSymbol2DShape(maPosition.X, maPosition.Y, maSize.Width, maSize.Height, mnStandardSymbol); } DummyCircle::DummyCircle(const awt::Point& rPos, const awt::Size& rSize) diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx index 49ab3ea097c8..e80e210408a5 100755 --- a/chart2/source/view/main/OpenGLRender.cxx +++ b/chart2/source/view/main/OpenGLRender.cxx @@ -384,6 +384,11 @@ int OpenGLRender::InitOpenGL(GLWindow aWindow) m_BackgroundVertexID = glGetAttribLocation(m_BackgroundProID, "vPosition"); m_BackgroundColorID = glGetAttribLocation(m_BackgroundProID, "vColor"); + m_SymbolProID = LoadShaders("symbolVertexShader", "symbolFragmentShader"); + m_SymbolVertexID = glGetAttribLocation(m_SymbolProID, "vPosition"); + m_SymbolMatrixID = glGetAttribLocation(m_SymbolProID, "MVP"); + m_SymbolColorID = glGetAttribLocation(m_SymbolProID, "vColor"); + m_TextProID = LoadShaders("textVertexShader", "textFragmentShader"); m_TextMatrixID = glGetUniformLocation(m_TextProID, "MVP"); m_TextVertexID = glGetAttribLocation(m_TextProID, "vPosition"); @@ -1720,67 +1725,48 @@ int OpenGLRender::RenderPieSegment2DShape(float fSize, float fPosX, float fPosY) CHECK_GL_ERROR(); return 0; } -int OpenGLRender::SetSymbol2DShapePoint(float x, float y, int listLength) -{ - if (m_Symbol2DPointList.empty()) - { - m_Symbol2DPointList.reserve(listLength); - } - float actualX = (x / OPENGL_SCALE_VALUE); - float actualY = (y / OPENGL_SCALE_VALUE); - m_Symbol2DPointList.push_back(actualX); - m_Symbol2DPointList.push_back(actualY); - m_Symbol2DPointList.push_back(m_fZStep); - - if (m_Symbol2DPointList.size() == size_t(listLength * 3)) - { - m_Symbol2DShapePointList.push_back(m_Symbol2DPointList); - m_Symbol2DPointList.clear(); - } - return 0; -} - -int OpenGLRender::RenderSymbol2DShape() +int OpenGLRender::RenderSymbol2DShape(float x, float y, float width, float height, sal_Int32) { CHECK_GL_ERROR(); + glDisable(GL_POINT_SMOOTH); glDisable(GL_MULTISAMPLE); - size_t listNum = m_Symbol2DShapePointList.size(); - PosVecf3 trans = {0.0f, 0.0f, 0.0f}; + glPointSize(10.f); + PosVecf3 trans = {x/OPENGL_SCALE_VALUE, y/OPENGL_SCALE_VALUE, m_fZStep}; PosVecf3 angle = {0.0f, 0.0f, 0.0f}; - PosVecf3 scale = {1.0f, 1.0f, 1.0f}; + PosVecf3 scale = {width/OPENGL_SCALE_VALUE, height/OPENGL_SCALE_VALUE, 1.0f}; MoveModelf(trans, angle, scale); m_MVP = m_Projection * m_View * m_Model; - for (size_t i = 0; i < listNum; ++i) - { - PointList &pointList = m_Symbol2DShapePointList.back(); - //fill vertex buffer - glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer); - glBufferData(GL_ARRAY_BUFFER, pointList.size() * sizeof(float), &pointList[0], GL_STATIC_DRAW); - // Use our shader - glUseProgram(m_CommonProID); - glUniform4fv(m_2DColorID, 1, &m_2DColor[0]); + float aPos[3] = { 0.f, 0.f, 0.f }; + //fill vertex buffer + glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer); + glBufferData(GL_ARRAY_BUFFER, 3 * sizeof(float), aPos, GL_STATIC_DRAW); - glUniformMatrix4fv(m_MatrixID, 1, GL_FALSE, &m_MVP[0][0]); + // Use our shader + glUseProgram(m_SymbolProID); - // 1rst attribute buffer : vertices - 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. + glUniform4fv(m_SymbolColorID, 1, &m_2DColor[0]); + + glUniformMatrix4fv(m_SymbolMatrixID, 1, GL_FALSE, &m_MVP[0][0]); + + // 1rst attribute buffer : vertices + glEnableVertexAttribArray(m_SymbolVertexID); + glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer); + glVertexAttribPointer( + m_SymbolVertexID, // attribute. No particular reason for 0, but must match the layout in the shader. 3, // size GL_FLOAT, // type GL_FALSE, // normalized? 0, // stride (void*)0 // array buffer offset ); - glDrawArrays(GL_POLYGON, 0, pointList.size() / 3); // 12*3 indices starting at 0 -> 12 triangles - glDisableVertexAttribArray(m_2DVertexID); - glUseProgram(0); - m_Symbol2DShapePointList.pop_back(); - } + glDrawArrays(GL_POINTS, 0, 1); // 12*3 indices starting at 0 -> 12 triangles + + glDisableVertexAttribArray(m_SymbolVertexID); + glUseProgram(0); glEnable(GL_MULTISAMPLE); + glEnable(GL_POINT_SMOOTH); m_fZStep += 0.01f; CHECK_GL_ERROR(); diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx index 2faf556e230b..76217ac04724 100755 --- a/chart2/source/view/main/OpenGLRender.hxx +++ b/chart2/source/view/main/OpenGLRender.hxx @@ -180,8 +180,7 @@ public: void GeneratePieSegment2D(double, double, double, double); int RenderPieSegment2DShape(float, float, float); - int SetSymbol2DShapePoint(float, float, int); - int RenderSymbol2DShape(); + int RenderSymbol2DShape(float, float, float, float, sal_Int32); #if DEBUG_POSITIONING void renderDebug(); #endif @@ -306,6 +305,11 @@ private: PointList m_Symbol2DPointList; std::list<PointList> m_Symbol2DShapePointList; + GLuint m_SymbolProID; + GLuint m_SymbolVertexID; + GLuint m_SymbolMatrixID; + GLuint m_SymbolColorID; + #if DEBUG_POSITIONING GLuint m_DebugProID; GLuint m_DebugVertexID; |