chart2/source/view/main/OpenGLRender.cxx | 27 +++++++++++++-------------- chart2/source/view/main/OpenGLRender.hxx | 2 -- 2 files changed, 13 insertions(+), 16 deletions(-)
New commits: commit 66efa731ff32d4ccd0769bf2a0e1345d5addea18 Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Sun Jan 12 18:23:35 2014 +0100 try to use orthographic projection Change-Id: I6e0baf23cea7d1883ca910ee13819ea58bbf7695 diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx index e57666c..e7de497 100644 --- a/chart2/source/view/main/OpenGLRender.cxx +++ b/chart2/source/view/main/OpenGLRender.cxx @@ -424,7 +424,7 @@ int OpenGLRender::InitOpenGL(GLWindow aWindow) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //Init the Projection matrix - m_Projection = glm::perspective(45.0f, 4.0f / 3.0f, 0.1f, 100.0f); + m_Projection = glm::ortho(0.f, float(m_iWidth), 0.f, float(m_iHeight), -1.f, 1.f); m_View = glm::lookAt(glm::vec3(0,0,1), // Camera is at (4,3,-3), in World Space glm::vec3(0,0,0), // and looks at the origin glm::vec3(0,1,0) // Head is up (set to 0,-1,0 to look upside-down) @@ -540,8 +540,8 @@ int OpenGLRender::SetLine2DShapePoint(float x, float y, int listLength) { m_Line2DPointList.reserve(listLength*3); } - float actualX = (x / OPENGL_SCALE_VALUE) - ((float)m_iWidth / 2); - float actualY = (y / OPENGL_SCALE_VALUE) - ((float)m_iHeight / 2); + float actualX = (x / OPENGL_SCALE_VALUE); + float actualY = (y / OPENGL_SCALE_VALUE); m_Line2DPointList.push_back(actualX); m_Line2DPointList.push_back(actualY); m_Line2DPointList.push_back(m_fZStep); @@ -568,6 +568,7 @@ int OpenGLRender::RenderLine2FBO(int) PosVecf3 angle = {0.0f, 0.0f, 0.0f}; PosVecf3 scale = {1.0f, 1.0f, 1.0f}; MoveModelf(trans, angle, scale); + m_Projection = glm::ortho(0.f, float(m_iWidth), 0.f, float(m_iHeight), -1.f, 1.f); m_MVP = m_Projection * m_View * m_Model; for (size_t i = 0; i < listNum; i++) { commit 695908337e5063bf02e213668a10adac50e9b8d3 Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Sun Jan 12 18:22:16 2014 +0100 only use one variable for alpha It was confusing and in some places we already used the wrong variable. Change-Id: Ib3a0f0e500530be0b502301233e5e853abe9f889 diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx index 963ef2b..e57666c 100644 --- a/chart2/source/view/main/OpenGLRender.cxx +++ b/chart2/source/view/main/OpenGLRender.cxx @@ -881,7 +881,6 @@ OpenGLRender::OpenGLRender(uno::Reference< drawing::XShape > xTarget): m_RboID(0), m_iWidth(0), m_iHeight(0), - m_fLineAlpha(1.0), mxRenderTarget(xTarget), mbArbMultisampleSupported(false), m_TextVertexID(0), @@ -963,7 +962,7 @@ int OpenGLRender::CreateBMPHeader(sal_uInt8 *bmpHeader, int xsize, int ysize) void OpenGLRender::SetLine2DColor(sal_uInt8 r, sal_uInt8 g, sal_uInt8 b) { - m_Line2DColor = glm::vec4((float)r / 255.0f, (float)g / 255.0f, (float)b / 255.0f, m_fLineAlpha); + m_Line2DColor = glm::vec4((float)r / 255.0f, (float)g / 255.0f, (float)b / 255.0f, m_fAlpha); } void OpenGLRender::SetLine2DWidth(int width) @@ -1180,7 +1179,7 @@ void OpenGLRender::SetColor(sal_uInt32 color) sal_uInt8 r = (color & 0x00FF0000) >> 16; sal_uInt8 g = (color & 0x0000FF00) >> 8; sal_uInt8 b = (color & 0x000000FF); - m_2DColor = glm::vec4((float)r / 255.0f, (float)g / 255.0f, (float)b / 255.0f, m_fLineAlpha); + m_2DColor = glm::vec4((float)r / 255.0f, (float)g / 255.0f, (float)b / 255.0f, m_fAlpha); } int OpenGLRender::CreateMultiSampleFrameBufObj() diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx index 65c0b91..9dd0777 100644 --- a/chart2/source/view/main/OpenGLRender.hxx +++ b/chart2/source/view/main/OpenGLRender.hxx @@ -259,8 +259,6 @@ private: float m_fLineWidth; - float m_fLineAlpha; - std::list <Line2DPointList> m_Line2DShapePointList; com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxRenderTarget; commit 378f64064ca522cebe554c82ba723293dba410b9 Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Sun Jan 12 18:21:32 2014 +0100 a bit more clean-up Change-Id: Ib6a3ef54fdd7b0582b691ae5e4d2ff998bd17b54 diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx index 4814b7c..963ef2b 100644 --- a/chart2/source/view/main/OpenGLRender.cxx +++ b/chart2/source/view/main/OpenGLRender.cxx @@ -538,7 +538,7 @@ int OpenGLRender::SetLine2DShapePoint(float x, float y, int listLength) { if (m_Line2DPointList.empty()) { - m_Line2DPointList.reserve(listLength); + m_Line2DPointList.reserve(listLength*3); } float actualX = (x / OPENGL_SCALE_VALUE) - ((float)m_iWidth / 2); float actualY = (y / OPENGL_SCALE_VALUE) - ((float)m_iHeight / 2); @@ -592,7 +592,7 @@ int OpenGLRender::RenderLine2FBO(int) glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer); CHECK_GL_ERROR(); glVertexAttribPointer( - m_2DVertexID, // attribute. No particular reason for 0, but must match the layout in the shader. + m_2DVertexID, 3, // size GL_FLOAT, // type GL_FALSE, // normalized? @@ -616,9 +616,6 @@ int OpenGLRender::RenderLine2FBO(int) void OpenGLRender::prepareToRender() { glViewport(0, 0, m_iWidth, m_iHeight); - glClearDepth(1.0f); - // Clear the screen - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if (!m_FboID) { // create a texture object @@ -643,7 +640,9 @@ void OpenGLRender::prepareToRender() } // Clear the screen + glClearDepth(1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + m_fZStep = 0; } void OpenGLRender::renderToBitmap() @@ -667,8 +666,8 @@ void OpenGLRender::renderToBitmap() glBlitFramebuffer(0, 0 ,m_iWidth, m_iHeight, 0, 0,m_iWidth ,m_iHeight, GL_COLOR_BUFFER_BIT, GL_LINEAR); glBindFramebuffer(GL_READ_FRAMEBUFFER,0); glBindFramebuffer(GL_DRAW_FRAMEBUFFER,0); - glBindFramebuffer(GL_FRAMEBUFFER, m_FboID); } + glBindFramebuffer(GL_FRAMEBUFFER, m_FboID); #if RENDER_TO_FILE char fileName[256] = {0}; commit a2934ecce37e27a9f99934521d6051aaf3e16133 Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Sun Jan 12 18:20:21 2014 +0100 fix size of graphic Change-Id: I2317083eca1034fe1d69b8716304c9f6d5cf5067 diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx index f5ef950..4814b7c 100644 --- a/chart2/source/view/main/OpenGLRender.cxx +++ b/chart2/source/view/main/OpenGLRender.cxx @@ -685,7 +685,7 @@ void OpenGLRender::renderToBitmap() uno::Reference< awt::XBitmap> xBmp( aGraphic.GetXGraphic(), uno::UNO_QUERY ); uno::Reference < beans::XPropertySet > xPropSet ( mxRenderTarget, uno::UNO_QUERY ); xPropSet->setPropertyValue("Graphic", uno::makeAny(aGraphic.GetXGraphic())); - mxRenderTarget->setSize(awt::Size(m_iWidth, m_iHeight)); + mxRenderTarget->setSize(awt::Size(m_iWidth*OPENGL_SCALE_VALUE, m_iHeight*OPENGL_SCALE_VALUE)); mxRenderTarget->setPosition(awt::Point(0,0)); #endif glBindFramebuffer(GL_FRAMEBUFFER, 0); commit 9fbff8b9157e622d375d769bf32703e74777a473 Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Sun Jan 12 18:18:02 2014 +0100 don't render to the file Change-Id: I8cf4b25c84564c0cb3195c5b63d0dde6d78d7080 diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx index f81e94c..f5ef950 100644 --- a/chart2/source/view/main/OpenGLRender.cxx +++ b/chart2/source/view/main/OpenGLRender.cxx @@ -44,7 +44,7 @@ using namespace com::sun::star; using namespace std; -#define RENDER_TO_FILE 1 +#define RENDER_TO_FILE 0 #define DEBUG_PNG 1 #define BMP_HEADER_LEN 54 _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits