[Libreoffice-commits] core.git: Branch 'feature/chart-opengl2' - 32 commits - chart2/source
Markus Mohrhard
markus.mohrhard at collabora.co.uk
Sun Jan 12 15:48:12 PST 2014
chart2/source/view/inc/AbstractShapeFactory.hxx | 2
chart2/source/view/inc/DummyXShape.hxx | 4
chart2/source/view/inc/OpenglShapeFactory.hxx | 1
chart2/source/view/inc/ShapeFactory.hxx | 2
chart2/source/view/main/ChartView.cxx | 1
chart2/source/view/main/DummyXShape.cxx | 26 +
chart2/source/view/main/OpenGLRender.cxx | 388 +++++++++++++-----------
chart2/source/view/main/OpenGLRender.hxx | 50 +--
chart2/source/view/main/OpenglShapeFactory.cxx | 7
9 files changed, 279 insertions(+), 202 deletions(-)
New commits:
commit 8cb726f3dc487b48f9de4b9e51018c678ca83f97
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Mon Jan 13 00:44:42 2014 +0100
fix line width
Change-Id: I9db787af08ef646d978106a9c91b95d6c57cf5ba
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 068722b..e6d2393 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -1031,7 +1031,7 @@ void OpenGLRender::SetLine2DColor(sal_uInt8 r, sal_uInt8 g, sal_uInt8 b)
void OpenGLRender::SetLine2DWidth(int width)
{
- m_fLineWidth = std::max((float)width / 10.0f, 0.001f);
+ m_fLineWidth = std::max((float)width / OPENGL_SCALE_VALUE, 0.001f);
}
#if defined( _WIN32 )
commit 0ef43bfca80697a19ba88926f9299ec7cbedacf0
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sun Jan 12 22:53:19 2014 +0100
fix missing clearing of rendering area
Now there are no artifacts left from earlier renderings.
Change-Id: I48e6585d838cdf9547c150e1484a967fc9b69329
diff --git a/chart2/source/view/inc/AbstractShapeFactory.hxx b/chart2/source/view/inc/AbstractShapeFactory.hxx
index 7efc30e..76d996f 100644
--- a/chart2/source/view/inc/AbstractShapeFactory.hxx
+++ b/chart2/source/view/inc/AbstractShapeFactory.hxx
@@ -241,6 +241,8 @@ public:
*/
virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xRootShape) = 0;
+ virtual void clearPage(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xRootShape) = 0;
+
static ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
getChartRootShape( const ::com::sun::star::uno::Reference<
::com::sun::star::drawing::XDrawPage>& xPage );
diff --git a/chart2/source/view/inc/DummyXShape.hxx b/chart2/source/view/inc/DummyXShape.hxx
index 91ec6d4..42eec30 100644
--- a/chart2/source/view/inc/DummyXShape.hxx
+++ b/chart2/source/view/inc/DummyXShape.hxx
@@ -426,7 +426,7 @@ public:
// normal methods
virtual void render();
-private:
+protected:
std::vector<com::sun::star::uno::Reference< com::sun::star::drawing::XShape > > maUNOShapes;
std::vector<DummyXShape*> maShapes;
};
@@ -443,6 +443,8 @@ public:
virtual void render() SAL_OVERRIDE;
+ void clear();
+
private:
GLWindow GLWin; /// Holds the information of our new child window
diff --git a/chart2/source/view/inc/OpenglShapeFactory.hxx b/chart2/source/view/inc/OpenglShapeFactory.hxx
index c7eb7a4..bb52da4 100644
--- a/chart2/source/view/inc/OpenglShapeFactory.hxx
+++ b/chart2/source/view/inc/OpenglShapeFactory.hxx
@@ -185,6 +185,7 @@ public:
virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xRootShape) SAL_OVERRIDE;
+ virtual void clearPage(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xRootShape) SAL_OVERRIDE;
};
}
diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx
index 259e923..99d8837 100644
--- a/chart2/source/view/inc/ShapeFactory.hxx
+++ b/chart2/source/view/inc/ShapeFactory.hxx
@@ -200,6 +200,8 @@ public:
*/
virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > ) SAL_OVERRIDE {}
+ virtual void clearPage(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > ) SAL_OVERRIDE {}
+
private:
ShapeFactory();
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index b0d6768..556d1f0 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -2412,6 +2412,7 @@ void ChartView::createShapes()
OSL_FAIL("could not set page size correctly");
}
pShapeFactory->setPageSize(mxRootShape, aPageSize);
+ pShapeFactory->clearPage(mxRootShape);
{
SolarMutexGuard aSolarGuard;
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index daa468a..596c0c4 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -1226,6 +1226,12 @@ void DummyChart::render()
m_GLRender.renderToBitmap();
}
+void DummyChart::clear()
+{
+ maUNOShapes.clear();
+ maShapes.clear();
+}
+
}
}
diff --git a/chart2/source/view/main/OpenglShapeFactory.cxx b/chart2/source/view/main/OpenglShapeFactory.cxx
index 8bb327e..dce9695 100644
--- a/chart2/source/view/main/OpenglShapeFactory.cxx
+++ b/chart2/source/view/main/OpenglShapeFactory.cxx
@@ -433,6 +433,13 @@ void OpenglShapeFactory::render(uno::Reference< drawing::XShapes > xRootShape)
pChart->render();
}
+void OpenglShapeFactory::clearPage(uno::Reference< drawing::XShapes > xRootShape)
+{
+ dummy::DummyChart* pChart = dynamic_cast<dummy::DummyChart*>(xRootShape.get());
+ assert(pChart);
+ pChart->clear();
+}
+
} //namespace dummy
} //namespace chart
commit 3d712fef9d67a879b0ebcd03e65750e90e0ed351
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sun Jan 12 22:50:47 2014 +0100
fix rectangle rendering
I had to disable it at the same time as it renders a white space over
the whole chart right now. Before the fix it was just the top left
quadrant.
Change-Id: I499767bcc302e6d6c82437535b4ea10ba212b82d
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index b4baa57..daa468a 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -568,6 +568,7 @@ DummyRectangle::DummyRectangle(const awt::Size& rSize, const awt::Point& rPoint,
void DummyRectangle::render()
{
+ /*
SAL_WARN("chart2.opengl", "render DummyRectangle");
debugProperties(maProperties);
DummyChart* pChart = getRootShape();
@@ -592,6 +593,7 @@ void DummyRectangle::render()
}
pChart->m_GLRender.RectangleShapePoint(maPosition.X, maPosition.Y, maSize.Width, maSize.Height);
pChart->m_GLRender.RenderRectangleShape();
+ */
}
DummyText::DummyText(const OUString& rText, const tNameSequence& rNames,
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 053a8bc..068722b 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -1400,7 +1400,7 @@ int OpenGLRender::RenderRectangleShape()
RectanglePointList &pointList = m_RectangleShapePointList.front();
PosVecf3 trans = {pointList.x, pointList.y, pointList.z};
PosVecf3 angle = {0.0f, 0.0f, 0.0f};
- PosVecf3 scale = {pointList.xScale / 2, pointList.yScale / 2, 1.0f};
+ PosVecf3 scale = {pointList.xScale, pointList.yScale, 1.0f};
MoveModelf(trans, angle, scale);
m_MVP = m_Projection * m_View * m_Model;
commit 85d1c9ca2b15730040d24b0137c4931eff5ff698
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sun Jan 12 22:15:40 2014 +0100
fix bubble rendering
Change-Id: Ice371673554a88b69866179b6b16944d6171e45d
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 7203745..053a8bc 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -1294,12 +1294,12 @@ int OpenGLRender::Bubble2DShapePoint(float x, float y, float directionX, float d
Create2DCircle(100);
}
- float actualX = (x / 10.0f);
- float actualY = (y / 10.0f);
+ float actualX = (x / OPENGL_SCALE_VALUE);
+ float actualY = (y / OPENGL_SCALE_VALUE);
m_Bubble2DPointList.x = actualX;
m_Bubble2DPointList.y = actualY;
- m_Bubble2DPointList.xScale = directionX / 10.0f;
- m_Bubble2DPointList.yScale = directionY / 10.0f;
+ m_Bubble2DPointList.xScale = directionX / OPENGL_SCALE_VALUE;
+ m_Bubble2DPointList.yScale = directionY / OPENGL_SCALE_VALUE;
m_fPicLeft = std::min(m_fPicLeft, actualX);
m_fPicRight = std::max(m_fPicRight, actualX);
commit f921eefcacfaa7720ea6bedb64ee7ef3d3d63dfd
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sun Jan 12 21:59:27 2014 +0100
fix the remaining projection issues
Change-Id: I3d6b7126b8c23e5cd1e60d49fa8cd6ebb0c9a6d1
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index b55183e..b4baa57 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -1216,7 +1216,11 @@ void DummyChart::render()
{
SAL_WARN("chart2.opengl", "render chart");
m_GLRender.prepareToRender();
+#if 0
+ m_GLRender.renderDebug();
+#else
DummyXShapes::render();
+#endif
m_GLRender.renderToBitmap();
}
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index e7de497..7203745 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -63,6 +63,34 @@ using namespace std;
//begin shaders
+#if DEBUG_POSITIONING
+
+const char* DebugVertexShader = OPENGL_SHADER (
+
+attribute vec3 vPosition;
+uniform vec4 vColor;
+varying vec4 fragmentColor;
+
+void main()
+{
+ gl_Position = vec4(vPosition, 1);
+}
+
+);
+
+const char* DebugFragmentShader = OPENGL_SHADER (
+
+varying vec4 fragmentColor;
+
+void main()
+{
+ gl_FragColor = vec4(1.0, 1.0, 0.0, 0.5);
+}
+
+);
+
+#endif
+
const char *CommonFragmemtShader = OPENGL_SHADER (
varying vec4 fragmentColor;
@@ -442,6 +470,13 @@ int OpenGLRender::InitOpenGL(GLWindow aWindow)
m_MatrixID = glGetUniformLocation(m_CommonProID, "MVP");
m_2DVertexID = glGetAttribLocation(m_CommonProID, "vPosition");
m_2DColorID = glGetUniformLocation(m_CommonProID, "vColor");
+ CHECK_GL_ERROR();
+
+#if DEBUG_POSITIONING
+ m_DebugProID = LoadShaders(DebugVertexShader, DebugFragmentShader);
+ m_DebugVertexID = glGetAttribLocation(m_DebugProID, "vPosition");
+#endif
+ CHECK_GL_ERROR();
m_BackgroundProID = LoadShaders(BackgroundVertexShader, BackgroundFragmemtShader);
m_BackgroundMatrixID = glGetUniformLocation(m_BackgroundProID, "MVP");
@@ -520,7 +555,7 @@ BitmapEx OpenGLRender::GetAsBitmap()
#if DEBUG_PNG // debug PNG writing
static int nIdx = 0;
- OUString aName = OUString( "file://c/temp/image" ) + OUString::number( nIdx++ ) + ".png";
+ OUString aName = OUString( "file:///home/moggi/Documents/work/" ) + OUString::number( nIdx++ ) + ".png";
try {
vcl::PNGWriter aWriter( aBmp );
SvFileStream sOutput( aName, STREAM_WRITE );
@@ -544,7 +579,7 @@ int OpenGLRender::SetLine2DShapePoint(float x, float y, int listLength)
float actualY = (y / OPENGL_SCALE_VALUE);
m_Line2DPointList.push_back(actualX);
m_Line2DPointList.push_back(actualY);
- m_Line2DPointList.push_back(m_fZStep);
+ m_Line2DPointList.push_back(0);
m_fPicLeft = std::min(m_fPicLeft, actualX);
m_fPicRight = std::max(m_fPicRight, actualX);
@@ -568,7 +603,6 @@ 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++)
{
@@ -582,15 +616,13 @@ int OpenGLRender::RenderLine2FBO(int)
glUseProgram(m_CommonProID);
CHECK_GL_ERROR();
- glUniform4fv(m_2DColorID, 1, &m_Line2DColor[0]);
+ glm::vec4 aColor(1.0,0.5,0.5,0.5);
+ glUniform4fv(m_2DColorID, 1, &aColor[0]);
CHECK_GL_ERROR();
glUniformMatrix4fv(m_MatrixID, 1, GL_FALSE, &m_MVP[0][0]);
- CHECK_GL_ERROR();
+ //CHECK_GL_ERROR();
// 1rst attribute buffer : vertices
- glEnableVertexAttribArray(m_2DVertexID);
- CHECK_GL_ERROR();
- glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
CHECK_GL_ERROR();
glVertexAttribPointer(
m_2DVertexID,
@@ -600,11 +632,11 @@ int OpenGLRender::RenderLine2FBO(int)
0, // stride
(void*)0 // array buffer offset
);
+ glEnableVertexAttribArray(m_2DVertexID);
glDrawArrays(GL_LINE_STRIP, 0, pointList.size()/3); // 12*3 indices starting at 0 -> 12 triangles
CHECK_GL_ERROR();
- glDisableVertexAttribArray(m_2DVertexID);
- CHECK_GL_ERROR();
glUseProgram(0);
+ glDisableVertexAttribArray(m_2DVertexID);
CHECK_GL_ERROR();
m_Line2DShapePointList.pop_front();
}
@@ -614,6 +646,35 @@ int OpenGLRender::RenderLine2FBO(int)
return 0;
}
+#if DEBUG_POSITIONING
+void OpenGLRender::renderDebug()
+{
+ CHECK_GL_ERROR();
+
+ GLfloat vertices[4][3] = {
+ {-0.9, -0.9, 0 },
+ {-0.6, -0.2, 0 },
+ {0.3, 0.3, 0 },
+ {0.9, 0.9, 0 } };
+
+ glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
+ CHECK_GL_ERROR();
+ glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
+ CHECK_GL_ERROR();
+ glUseProgram(m_DebugProID);
+ CHECK_GL_ERROR();
+ glVertexAttribPointer(m_DebugVertexID, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
+ CHECK_GL_ERROR();
+ glEnableVertexAttribArray(m_DebugVertexID);
+
+ glDrawArrays(GL_LINE_STRIP, 0, 3);
+ CHECK_GL_ERROR();
+ glDisableVertexAttribArray(m_DebugVertexID);
+
+ CHECK_GL_ERROR();
+}
+#endif
+
void OpenGLRender::prepareToRender()
{
glViewport(0, 0, m_iWidth, m_iHeight);
@@ -913,11 +974,13 @@ OpenGLRender::~OpenGLRender()
void OpenGLRender::SetWidth(int width)
{
m_iWidth = width;
+ m_Projection = glm::ortho(0.f, float(m_iWidth), 0.f, float(m_iHeight), -4.f, 3.f);
}
void OpenGLRender::SetHeight(int height)
{
m_iHeight = height;
+ m_Projection = glm::ortho(0.f, float(m_iWidth), 0.f, float(m_iHeight), -4.f, 3.f);
}
int OpenGLRender::GetWidth()
@@ -1231,8 +1294,8 @@ int OpenGLRender::Bubble2DShapePoint(float x, float y, float directionX, float d
Create2DCircle(100);
}
- float actualX = (x / 10.0f) - ((float)m_iWidth / 2);
- float actualY = (y / 10.0f) - ((float)m_iHeight / 2);
+ float actualX = (x / 10.0f);
+ float actualY = (y / 10.0f);
m_Bubble2DPointList.x = actualX;
m_Bubble2DPointList.y = actualY;
m_Bubble2DPointList.xScale = directionX / 10.0f;
@@ -1434,8 +1497,8 @@ int OpenGLRender::CreateTextTexture(::rtl::OUString textValue, sal_uInt32 color,
}
}
aBitmap.ReleaseAccess(pRAcc);
- m_TextInfo.x = (float)(aPos.X + aSize.Width / 2) / OPENGL_SCALE_VALUE - ((float)m_iWidth / 2);
- m_TextInfo.y = (float)(aPos.Y + aSize.Height / 2) / OPENGL_SCALE_VALUE - ((float)m_iHeight / 2);
+ m_TextInfo.x = (float)(aPos.X + aSize.Width / 2) / OPENGL_SCALE_VALUE;
+ m_TextInfo.y = (float)(aPos.Y + aSize.Height / 2) / OPENGL_SCALE_VALUE;
m_TextInfo.z = m_fZStep;
m_TextInfo.rotation = -(double)rotation * GL_PI / 18000.0f;
m_TextInfo.vertex[0] = (float)(-aSize.Width / 2) / OPENGL_SCALE_VALUE;
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
index 9dd0777..fd8013a 100644
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -53,6 +53,7 @@ namespace unx
#include "glm/gtx/quaternion.hpp"
#define OPENGL_SCALE_VALUE 20
+#define DEBUG_POSITIONING 1
typedef struct PosVeci3
{
@@ -67,7 +68,7 @@ typedef struct PosVecf3
float z;
}PosVecf3;
-typedef std::vector<float> Line2DPointList;
+typedef std::vector<GLfloat> Line2DPointList;
typedef struct Bubble2DPointList
{
@@ -102,7 +103,7 @@ typedef struct TextInfo
float vertex[8];
}TextInfo;
-typedef std::vector<float> Area2DPointList;
+typedef std::vector<GLfloat> Area2DPointList;
/// Holds the information of our new child window
struct GLWindow
@@ -178,6 +179,10 @@ public:
int RenderArea2DShape();
void SetChartTransparencyGradient(long transparencyGradient);
+#if DEBUG_POSITIONING
+ void renderDebug();
+#endif
+
private:
GLint LoadShaders(const char *vertexShader,const char *fragmentShader);
int CreateTextureObj(int width, int height);
@@ -318,6 +323,12 @@ private:
float m_BackgroundColor[16];
glm::vec4 m_ClearColor;
+#if DEBUG_POSITIONING
+ GLuint m_DebugProID;
+ GLuint m_DebugVertexID;
+ GLuint m_DebugColorID;
+#endif
+
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 66efa731ff32d4ccd0769bf2a0e1345d5addea18
Author: Markus Mohrhard <markus.mohrhard at 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.mohrhard at 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.mohrhard at 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.mohrhard at 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.mohrhard at 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
commit 59f7f8cd289fadb0ee6dcdfc01018cb1f7fecc62
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sun Jan 12 16:05:29 2014 +0100
delete all programs at the end
Change-Id: I6a2e0a70e9b6eadcb869596471f702bca4145336
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 66118fb..f81e94c 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -843,10 +843,12 @@ void OpenGLRender::Release()
{
glDeleteBuffers(1, &m_VertexBuffer);
glDeleteBuffers(1, &m_ColorBuffer);
- glDeleteProgram(m_ProgramID);
glDeleteBuffers(1, &m_RenderVertexBuf);
glDeleteBuffers(1, &m_RenderTexCoordBuf);
glDeleteProgram(m_RenderProID);
+ glDeleteProgram(m_CommonProID);
+ glDeleteProgram(m_TextProID);
+ glDeleteProgram(m_BackgroundProID);
glDeleteFramebuffers(1, &m_FboID);
glDeleteTextures(1, &m_TextureObj);
glDeleteRenderbuffers(1, &m_RboID);
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
index 41fa81e..65c0b91 100644
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -209,8 +209,6 @@ private:
glm::mat4 m_ScaleMatrix;
- GLuint m_ProgramID;
-
GLint m_RenderProID;
glm::vec4 m_Line2DColor;
commit c102d8d4b8122c7d5e7bb32f663e43562a0bddf2
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sun Jan 12 16:02:17 2014 +0100
use std::min
Change-Id: I8ffaf5e5ed418901658ca6b7e3d1ad369ee0baba
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 99cb450..66118fb 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -967,8 +967,7 @@ void OpenGLRender::SetLine2DColor(sal_uInt8 r, sal_uInt8 g, sal_uInt8 b)
void OpenGLRender::SetLine2DWidth(int width)
{
- m_fLineWidth = (float)width / 10.0f;
- m_fLineWidth = (m_fLineWidth < 0.001) ? 0.001 : m_fLineWidth;
+ m_fLineWidth = std::max((float)width / 10.0f, 0.001f);
}
#if defined( _WIN32 )
commit e92af2401fa245506094fcdcab7bb51d23486b18
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sun Jan 12 15:58:48 2014 +0100
formatting
Change-Id: I3806d3b74e850812ccb24dea0580759529c154cc
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
index 8b15dbf..41fa81e 100644
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -272,9 +272,9 @@ private:
GLint m_iSamples;
glm::vec4 m_2DColor;
- GLuint m_frameBufferMS;
- GLuint m_renderBufferColorMS;
- GLuint m_renderBufferDepthMS;
+ GLuint m_frameBufferMS;
+ GLuint m_renderBufferColorMS;
+ GLuint m_renderBufferDepthMS;
float m_fPicRight;
commit cbfd328632995eb67813151bfb28e47002e1fe8e
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sun Jan 12 15:57:38 2014 +0100
remove unused variable
Change-Id: Ia563d4628e322bfde82ccca02b107c5e954a0205
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 3640451..99cb450 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -874,7 +874,6 @@ OpenGLRender::OpenGLRender(uno::Reference< drawing::XShape > xTarget):
m_TranslationMatrix(glm::translate(m_Model, glm::vec3(0.0f, 0.0f, 0.0f))),
m_RotationMatrix(glm::eulerAngleYXZ(0.0f, 0.0f, 0.0f)),
m_ScaleMatrix(glm::scale(m_Model, glm::vec3(1.0f, 1.0f, 1.0f))),
- m_Line2DProID(0), // TODO: moggi: why is it unused?
m_Line2DColor(glm::vec4(1.0, 0.0, 0.0, 1.0)),
m_TextureObj(0),
m_FboID(0),
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
index b7aae83..8b15dbf 100644
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -213,8 +213,6 @@ private:
GLint m_RenderProID;
- GLint m_Line2DProID;
-
glm::vec4 m_Line2DColor;
GLuint m_VertexBuffer;
commit 72dd2a8a39298944b89eaf77da50c2e11fe54b90
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sun Jan 12 15:53:56 2014 +0100
we are rendering to FBO so no need for two objects
Change-Id: I6a900244160c974feefb45ecb41d581050e955e2
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index ff6b6b6..3640451 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -619,7 +619,7 @@ void OpenGLRender::prepareToRender()
glClearDepth(1.0f);
// Clear the screen
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- if ((!m_FboID[0]) || (!m_FboID[1]))
+ if (!m_FboID)
{
// create a texture object
CreateTextureObj(m_iWidth, m_iHeight);
@@ -639,7 +639,7 @@ void OpenGLRender::prepareToRender()
}
else
{
- glBindFramebuffer(GL_FRAMEBUFFER, m_FboID[m_iFboIdx % 2]);
+ glBindFramebuffer(GL_FRAMEBUFFER, m_FboID);
}
// Clear the screen
@@ -658,7 +658,7 @@ void OpenGLRender::renderToBitmap()
{
SAL_INFO("chart2.opengl", "The frame buffer status is not complete!");
}
- glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_FboID[m_iFboIdx % 2]);
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_FboID);
status = glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE)
{
@@ -667,12 +667,12 @@ 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[m_iFboIdx % 2]);
+ glBindFramebuffer(GL_FRAMEBUFFER, m_FboID);
}
#if RENDER_TO_FILE
char fileName[256] = {0};
- sprintf(fileName, "D:\\shaderout_%d_%d_%d.bmp", m_iWidth, m_iHeight, m_iFboIdx);
+ sprintf(fileName, "D:\\shaderout_%d_%d.bmp", m_iWidth, m_iHeight);
sal_uInt8 *buf = (sal_uInt8 *)malloc(m_iWidth * m_iHeight * 3 + BMP_HEADER_LEN);
CreateBMPHeader(buf, m_iWidth, m_iHeight);
glReadPixels(0, 0, m_iWidth, m_iHeight, GL_BGR, GL_UNSIGNED_BYTE, buf + BMP_HEADER_LEN);
@@ -695,8 +695,6 @@ void OpenGLRender::renderToBitmap()
unx::glXSwapBuffers(glWin.dpy, glWin.win);
#endif
glFlush();
- m_iFboIdx++;
-
}
int OpenGLRender::RenderTexture2FBO(GLuint TexID)
@@ -785,18 +783,8 @@ int OpenGLRender::RenderTexture(GLuint TexID)
int OpenGLRender::CreateTextureObj(int width, int height)
{
- glGenTextures(1, &m_TextureObj[0]);
- glBindTexture(GL_TEXTURE_2D, m_TextureObj[0]);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
- CHECK_GL_ERROR();
- glBindTexture(GL_TEXTURE_2D, 0);
-
- glGenTextures(1, &m_TextureObj[1]);
- glBindTexture(GL_TEXTURE_2D, m_TextureObj[1]);
+ glGenTextures(1, &m_TextureObj);
+ glBindTexture(GL_TEXTURE_2D, m_TextureObj);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
@@ -809,18 +797,9 @@ int OpenGLRender::CreateTextureObj(int width, int height)
int OpenGLRender::CreateRenderObj(int width, int height)
{
- glGenRenderbuffers(1, &m_RboID[0]);
+ glGenRenderbuffers(1, &m_RboID);
CHECK_GL_ERROR();
- glBindRenderbuffer(GL_RENDERBUFFER, m_RboID[0]);
- CHECK_GL_ERROR();
- glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, width, height);
- CHECK_GL_ERROR();
- glBindRenderbuffer(GL_RENDERBUFFER, 0);
- CHECK_GL_ERROR();
-
- glGenRenderbuffers(1, &m_RboID[1]);
- CHECK_GL_ERROR();
- glBindRenderbuffer(GL_RENDERBUFFER, m_RboID[1]);
+ glBindRenderbuffer(GL_RENDERBUFFER, m_RboID);
CHECK_GL_ERROR();
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, width, height);
CHECK_GL_ERROR();
@@ -842,32 +821,17 @@ int OpenGLRender::CreateFrameBufferObj()
{
GLenum status;
// create a framebuffer object, you need to delete them when program exits.
- glGenFramebuffers(1, &m_FboID[0]);
- CHECK_GL_FRAME_BUFFER_STATUS();
- glBindFramebuffer(GL_FRAMEBUFFER, m_FboID[0]);
- glBindTexture(GL_TEXTURE_2D, m_TextureObj[0]);
- // attach a texture to FBO color attachement point
- glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_TextureObj[0], 0);
- CHECK_GL_FRAME_BUFFER_STATUS();
- glBindTexture(GL_TEXTURE_2D, 0);
- // attach a renderbuffer to depth attachment point
- glBindRenderbuffer(GL_RENDERBUFFER, m_RboID[0]);
- glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_RboID[0]);
- CHECK_GL_FRAME_BUFFER_STATUS();
- glBindRenderbuffer(GL_RENDERBUFFER, 0);
- glBindFramebuffer(GL_FRAMEBUFFER, 0);
-
- glGenFramebuffers(1, &m_FboID[1]);
+ glGenFramebuffers(1, &m_FboID);
CHECK_GL_FRAME_BUFFER_STATUS();
- glBindFramebuffer(GL_FRAMEBUFFER, m_FboID[1]);
- glBindTexture(GL_TEXTURE_2D, m_TextureObj[1]);
+ glBindFramebuffer(GL_FRAMEBUFFER, m_FboID);
+ glBindTexture(GL_TEXTURE_2D, m_TextureObj);
// attach a texture to FBO color attachement point
- glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_TextureObj[1], 0);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_TextureObj, 0);
CHECK_GL_FRAME_BUFFER_STATUS();
glBindTexture(GL_TEXTURE_2D, 0);
// attach a renderbuffer to depth attachment point
- glBindRenderbuffer(GL_RENDERBUFFER, m_RboID[1]);
- glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_RboID[1]);
+ glBindRenderbuffer(GL_RENDERBUFFER, m_RboID);
+ glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_RboID);
CHECK_GL_FRAME_BUFFER_STATUS();
glBindRenderbuffer(GL_RENDERBUFFER, 0);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
@@ -883,12 +847,9 @@ void OpenGLRender::Release()
glDeleteBuffers(1, &m_RenderVertexBuf);
glDeleteBuffers(1, &m_RenderTexCoordBuf);
glDeleteProgram(m_RenderProID);
- glDeleteFramebuffers(1, &m_FboID[0]);
- glDeleteFramebuffers(1, &m_FboID[1]);
- glDeleteTextures(1, &m_TextureObj[0]);
- glDeleteTextures(1, &m_TextureObj[1]);
- glDeleteRenderbuffers(1, &m_RboID[0]);
- glDeleteRenderbuffers(1, &m_RboID[1]);
+ glDeleteFramebuffers(1, &m_FboID);
+ glDeleteTextures(1, &m_TextureObj);
+ glDeleteRenderbuffers(1, &m_RboID);
#if defined( WNT )
wglMakeCurrent(NULL, NULL);
if (!m_iExternRC)
@@ -915,9 +876,11 @@ OpenGLRender::OpenGLRender(uno::Reference< drawing::XShape > xTarget):
m_ScaleMatrix(glm::scale(m_Model, glm::vec3(1.0f, 1.0f, 1.0f))),
m_Line2DProID(0), // TODO: moggi: why is it unused?
m_Line2DColor(glm::vec4(1.0, 0.0, 0.0, 1.0)),
+ m_TextureObj(0),
+ m_FboID(0),
+ m_RboID(0),
m_iWidth(0),
m_iHeight(0),
- m_iFboIdx(0),
m_fLineAlpha(1.0),
mxRenderTarget(xTarget),
mbArbMultisampleSupported(false),
@@ -931,13 +894,6 @@ OpenGLRender::OpenGLRender(uno::Reference< drawing::XShape > xTarget):
memset(&m_TextInfo, 0, sizeof(TextInfo));
memset(&m_RectangleList, 0, sizeof(RectanglePointList));
- m_iFboIdx = 0;
- m_FboID[0] = 0;
- m_FboID[1] = 0;
- m_TextureObj[0] = 0;
- m_TextureObj[1] = 0;
- m_RboID[0] = 0;
- m_RboID[1] = 0;
m_iArbMultisampleFormat = 0;
//TODO: moggi: use STL
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
index 8368fbc..b7aae83 100644
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -243,11 +243,11 @@ private:
GLuint m_RenderTexCoordBuf;
- GLuint m_TextureObj[2];
+ GLuint m_TextureObj;
- GLuint m_FboID[2];
+ GLuint m_FboID;
- GLuint m_RboID[2];
+ GLuint m_RboID;
int m_iWidth;
@@ -261,8 +261,6 @@ private:
Line2DPointList m_Line2DPointList;
- int m_iFboIdx;
-
float m_fLineWidth;
float m_fLineAlpha;
commit 3b7eef525a778e1f90692153bd7b134da8acee44
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sun Jan 12 15:16:58 2014 +0100
next step
Change-Id: I4307175107bc5ead4e74ee9fa9acfc6375e8260e
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index de708ca..ff6b6b6 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 0
+#define RENDER_TO_FILE 1
#define DEBUG_PNG 1
#define BMP_HEADER_LEN 54
@@ -578,7 +578,7 @@ int OpenGLRender::RenderLine2FBO(int)
glBufferData(GL_ARRAY_BUFFER, pointList.size() * sizeof(float), &pointList[0], GL_STATIC_DRAW);
CHECK_GL_ERROR();
// Use our shader
- glUseProgram(m_Line2DProID);
+ glUseProgram(m_CommonProID);
CHECK_GL_ERROR();
glUniform4fv(m_2DColorID, 1, &m_Line2DColor[0]);
@@ -644,8 +644,6 @@ void OpenGLRender::prepareToRender()
// Clear the screen
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- RenderTexture2FBO(m_TextureObj[(m_iFboIdx - 1) % 2]);
}
void OpenGLRender::renderToBitmap()
@@ -697,7 +695,6 @@ void OpenGLRender::renderToBitmap()
unx::glXSwapBuffers(glWin.dpy, glWin.win);
#endif
glFlush();
- RenderTexture(m_TextureObj[m_iFboIdx % 2]);
m_iFboIdx++;
}
commit e2ab0a7a2a4562af3bac65ebaf212e69917a1a5d
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sun Jan 12 14:48:12 2014 +0100
one more error
Change-Id: I7a40d5583a76d0b553a828bd2657c77fdca0f59a
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index ae784f2..de708ca 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -554,6 +554,7 @@ int OpenGLRender::SetLine2DShapePoint(float x, float y, int listLength)
if (m_Line2DPointList.size() == size_t(listLength * 3))
{
m_Line2DShapePointList.push_back(m_Line2DPointList);
+ m_Line2DPointList.clear();
}
return 0;
}
@@ -1651,6 +1652,7 @@ int OpenGLRender::SetArea2DShapePoint(float x, float y, int listLength)
if (m_Area2DPointList.size() == size_t(listLength * 3))
{
m_Area2DShapePointList.push_back(m_Area2DPointList);
+ m_Area2DPointList.clear();
}
return 0;
}
commit fd4d9bfa56f77bd32180110025914ad85895b5ce
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sun Jan 12 14:42:18 2014 +0100
ahh, think error
Change-Id: I400115ad802c1d00ec5f99e4f5fc952938de450a
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index e3868b6..ae784f2 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -551,7 +551,7 @@ int OpenGLRender::SetLine2DShapePoint(float x, float y, int listLength)
m_fPicBottom = std::min(m_fPicBottom, actualY);
m_fPicTop = std::max(m_fPicTop, actualY);
- if (m_Line2DPointList.size() == size_t((listLength * 3) - 1))
+ if (m_Line2DPointList.size() == size_t(listLength * 3))
{
m_Line2DShapePointList.push_back(m_Line2DPointList);
}
@@ -1648,7 +1648,7 @@ int OpenGLRender::SetArea2DShapePoint(float x, float y, int listLength)
m_fPicBottom = std::min(m_fPicBottom, actualY);
m_fPicTop = std::max(m_fPicTop, actualY);
- if (m_Area2DPointList.size() == size_t((listLength * 3) -1))
+ if (m_Area2DPointList.size() == size_t(listLength * 3))
{
m_Area2DShapePointList.push_back(m_Area2DPointList);
}
commit 4b039738da3366239a69c3efa69091a51fbc7abc
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sun Jan 12 14:40:11 2014 +0100
fix code for writting png files
Change-Id: I96244b99b2f5a9f22ca09c133687661b06229359
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index a5592d9..e3868b6 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -45,9 +45,13 @@ using namespace com::sun::star;
using namespace std;
#define RENDER_TO_FILE 0
-#define DEBUG_PNG 0
+#define DEBUG_PNG 1
#define BMP_HEADER_LEN 54
+#if DEBUG_PNG
+#include <vcl/pngwrite.hxx>
+#endif
+
#define OPENGL_SHADER( ... )# __VA_ARGS__
#define GL_PI 3.14159f
commit e5124ca12a22ddc0b54c82eaded68339d8c48d81
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sun Jan 12 14:19:36 2014 +0100
try to fix line rendering
The line rendering was not associated with a OpenGL program. This
resulted in runtime errros.
Change-Id: If0d0f015c3505eda908156743ce8bd6a43f644e4
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 2e6b176..a5592d9 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -559,6 +559,11 @@ int OpenGLRender::RenderLine2FBO(int)
CHECK_GL_ERROR();
glLineWidth(m_fLineWidth);
size_t listNum = m_Line2DShapePointList.size();
+ PosVecf3 trans = {0.0f, 0.0f, 0.0f};
+ PosVecf3 angle = {0.0f, 0.0f, 0.0f};
+ PosVecf3 scale = {1.0f, 1.0f, 1.0f};
+ MoveModelf(trans, angle, scale);
+ m_MVP = m_Projection * m_View * m_Model;
for (size_t i = 0; i < listNum; i++)
{
Line2DPointList &pointList = m_Line2DShapePointList.front();
@@ -571,16 +576,18 @@ int OpenGLRender::RenderLine2FBO(int)
glUseProgram(m_Line2DProID);
CHECK_GL_ERROR();
- glUniform4fv(m_Line2DColorID, 1, &m_Line2DColor[0]);
+ glUniform4fv(m_2DColorID, 1, &m_Line2DColor[0]);
+ CHECK_GL_ERROR();
+ glUniformMatrix4fv(m_MatrixID, 1, GL_FALSE, &m_MVP[0][0]);
CHECK_GL_ERROR();
// 1rst attribute buffer : vertices
- glEnableVertexAttribArray(m_Line2DVertexID);
+ glEnableVertexAttribArray(m_2DVertexID);
CHECK_GL_ERROR();
glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
CHECK_GL_ERROR();
glVertexAttribPointer(
- m_Line2DVertexID, // attribute. No particular reason for 0, but must match the layout in the shader.
+ m_2DVertexID, // attribute. No particular reason for 0, but must match the layout in the shader.
3, // size
GL_FLOAT, // type
GL_FALSE, // normalized?
@@ -589,7 +596,7 @@ int OpenGLRender::RenderLine2FBO(int)
);
glDrawArrays(GL_LINE_STRIP, 0, pointList.size()/3); // 12*3 indices starting at 0 -> 12 triangles
CHECK_GL_ERROR();
- glDisableVertexAttribArray(m_Line2DWholeVertexID);
+ glDisableVertexAttribArray(m_2DVertexID);
CHECK_GL_ERROR();
glUseProgram(0);
CHECK_GL_ERROR();
commit 9254d8e84e5cbbcd4fd24802d416a180c3b1ed5a
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sun Jan 12 13:46:46 2014 +0100
more formatting and TODO comments
for GL_QUADS see for example
http://stackoverflow.com/questions/6644099/what-is-so-bad-about-gl-quads
Change-Id: Ife53f1ac09125bc7e42c8aa91c53d7e7991ac0bf
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index f3786a1..2e6b176 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -718,6 +718,7 @@ int OpenGLRender::RenderTexture2FBO(GLuint TexID)
);
glBindTexture(GL_TEXTURE_2D, TexID);
glUniform1i(m_RenderTexID, 0);
+ //TODO: moggi: get rid fo GL_QUADS
glDrawArrays(GL_QUADS, 0, 4);
glDisableVertexAttribArray(m_RenderTexCoordID);
glDisableVertexAttribArray(m_RenderVertexID);
@@ -757,6 +758,7 @@ int OpenGLRender::RenderTexture(GLuint TexID)
);
glBindTexture(GL_TEXTURE_2D, TexID);
glUniform1i(m_RenderTexID, 0);
+ //TODO: moggi: get rid fo GL_QUADS
glDrawArrays(GL_QUADS, 0, 4);
glDisableVertexAttribArray(m_RenderTexCoordID);
glDisableVertexAttribArray(m_RenderVertexID);
@@ -1083,7 +1085,7 @@ bool OpenGLRender::InitMultisample(PIXELFORMATDESCRIPTOR pfd)
0,0
};
// First We Check To See If We Can Get A Pixel Format For 4 Samples
- valid = wglChoosePixelFormatARB(hDC,iAttributes,fAttributes,1,&pixelFormat,&numFormats);
+ valid = wglChoosePixelFormatARB(hDC, iAttributes, fAttributes, 1, &pixelFormat, &numFormats);
// If We Returned True, And Our Format Count Is Greater Than 1
if (valid && numFormats >= 1)
{
@@ -1097,7 +1099,7 @@ bool OpenGLRender::InitMultisample(PIXELFORMATDESCRIPTOR pfd)
}
// Our Pixel Format With 4 Samples Failed, Test For 2 Samples
iAttributes[19] = 2;
- valid = wglChoosePixelFormatARB(hDC,iAttributes,fAttributes,1,&pixelFormat,&numFormats);
+ valid = wglChoosePixelFormatARB(hDC, iAttributes, fAttributes, 1, &pixelFormat, &numFormats);
if (valid && numFormats >= 1)
{
mbArbMultisampleSupported = true;
@@ -1272,7 +1274,6 @@ int OpenGLRender::Bubble2DShapePoint(float x, float y, float directionX, float d
m_Bubble2DPointList.xScale = directionX / 10.0f;
m_Bubble2DPointList.yScale = directionY / 10.0f;
-
m_fPicLeft = std::min(m_fPicLeft, actualX);
m_fPicRight = std::max(m_fPicRight, actualX);
m_fPicBottom = std::min(m_fPicBottom, actualY);
@@ -1397,6 +1398,7 @@ int OpenGLRender::RenderRectangleShape()
0, // stride
(void*)0 // array buffer offset
);
+
// 2nd attribute buffer : color
glEnableVertexAttribArray(m_BackgroundColorID);
glBindBuffer(GL_ARRAY_BUFFER, m_ColorBuffer);
@@ -1408,6 +1410,7 @@ int OpenGLRender::RenderRectangleShape()
0, // stride
(void*)0 // array buffer offset
);
+ //TODO: moggi: get rid of GL_QUADS
glDrawArrays(GL_QUADS, 0, 4);
glDisableVertexAttribArray(m_BackgroundVertexID);
glDisableVertexAttribArray(m_BackgroundColorID);
@@ -1573,6 +1576,7 @@ int OpenGLRender::RenderTextShape()
//texture
glBindTexture(GL_TEXTURE_2D, textInfo.texture);
glUniform1i(m_TextTexID, 0);
+ //TODO: moggi: get rid fo GL_QUADS
glDrawArrays(GL_QUADS, 0, 4);
glDisableVertexAttribArray(m_TextTexCoordID);
glDisableVertexAttribArray(m_TextVertexID);
commit b2f278bd4eeeffa4a5094acefc1eb7da8aa7cd5c
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sun Jan 12 13:41:42 2014 +0100
more clean-up
Change-Id: Ie774afc8ab2c881c5f82be286c84fb3eb37821c1
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 980cd50..f3786a1 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -615,13 +615,13 @@ void OpenGLRender::prepareToRender()
CreateRenderObj(m_iWidth, m_iHeight);
//create fbo
CreateFrameBufferObj();
- if (m_iArbMultisampleSupported)
+ if (mbArbMultisampleSupported)
{
CreateMultiSampleFrameBufObj();
}
}
//bind fbo
- if (m_iArbMultisampleSupported)
+ if (mbArbMultisampleSupported)
{
glBindFramebuffer(GL_FRAMEBUFFER,m_frameBufferMS);
}
@@ -638,7 +638,7 @@ void OpenGLRender::prepareToRender()
void OpenGLRender::renderToBitmap()
{
- if (m_iArbMultisampleSupported)
+ if (mbArbMultisampleSupported)
{
GLenum status;
glBindFramebuffer(GL_FRAMEBUFFER, 0);
@@ -909,7 +909,7 @@ OpenGLRender::OpenGLRender(uno::Reference< drawing::XShape > xTarget):
m_iFboIdx(0),
m_fLineAlpha(1.0),
mxRenderTarget(xTarget),
- m_iArbMultisampleSupported(false),
+ mbArbMultisampleSupported(false),
m_TextVertexID(0),
m_TextTexCoordID(1),
m_ClearColor(glm::vec4(1.0f, 1.0f, 1.0f, 1.0f))
@@ -1038,22 +1038,22 @@ bool OpenGLRender::InitMultisample(PIXELFORMATDESCRIPTOR pfd)
//create a temp windwo to check whether support multi-sample, if support, get the format
if (InitTempWindow(&hWnd, m_iWidth, m_iHeight, pfd) < 0)
{
- SAL_WARN("chart2.opengl", "Can't create temp window to test\n");
+ SAL_WARN("chart2.opengl", "Can't create temp window to test");
return false;
}
// See If The String Exists In WGL!
if (!WGLisExtensionSupported("WGL_ARB_multisample"))
{
- m_iArbMultisampleSupported = false;
- SAL_WARN("chart2.opengl", "Device doesn't support multi sample\n");
+ mbArbMultisampleSupported = false;
+ SAL_WARN("chart2.opengl", "Device doesn't support multi sample");
return false;
}
// Get Our Pixel Format
PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
if (!wglChoosePixelFormatARB)
{
- m_iArbMultisampleSupported = false;
+ mbArbMultisampleSupported = false;
return false;
}
// Get Our Current Device Context
@@ -1087,39 +1087,39 @@ bool OpenGLRender::InitMultisample(PIXELFORMATDESCRIPTOR pfd)
// If We Returned True, And Our Format Count Is Greater Than 1
if (valid && numFormats >= 1)
{
- m_iArbMultisampleSupported = true;
+ mbArbMultisampleSupported = true;
m_iArbMultisampleFormat = pixelFormat;
wglMakeCurrent(NULL, NULL);
wglDeleteContext(glWin.hRC);
ReleaseDC(hWnd, glWin.hDC);
DestroyWindow(hWnd);
- return m_iArbMultisampleSupported;
+ return mbArbMultisampleSupported;
}
// Our Pixel Format With 4 Samples Failed, Test For 2 Samples
iAttributes[19] = 2;
valid = wglChoosePixelFormatARB(hDC,iAttributes,fAttributes,1,&pixelFormat,&numFormats);
if (valid && numFormats >= 1)
{
- m_iArbMultisampleSupported = true;
+ mbArbMultisampleSupported = true;
m_iArbMultisampleFormat = pixelFormat;
wglMakeCurrent(NULL, NULL);
wglDeleteContext(glWin.hRC);
ReleaseDC(hWnd, glWin.hDC);
DestroyWindow(hWnd);
- return m_iArbMultisampleSupported;
+ return mbArbMultisampleSupported;
}
// Return The Valid Format
wglMakeCurrent(NULL, NULL);
wglDeleteContext(glWin.hRC);
ReleaseDC(hWnd, glWin.hDC);
DestroyWindow(hWnd);
- return m_iArbMultisampleSupported;
+ return mbArbMultisampleSupported;
}
#endif
bool OpenGLRender::GetMSAASupport()
{
- return m_iArbMultisampleSupported;
+ return mbArbMultisampleSupported;
}
int OpenGLRender::GetMSAAFormat()
@@ -1415,6 +1415,7 @@ int OpenGLRender::RenderRectangleShape()
glBindBuffer(GL_ARRAY_BUFFER, 0);
m_RectangleShapePointList.pop_front();
}
+ CHECK_GL_ERROR();
return 0;
}
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
index 159bccb..8368fbc 100644
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -270,7 +270,7 @@ private:
std::list <Line2DPointList> m_Line2DShapePointList;
com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxRenderTarget;
- bool m_iArbMultisampleSupported;
+ bool mbArbMultisampleSupported;
int m_iArbMultisampleFormat;
GLint m_iSampleBufs;
GLint m_iSamples;
commit 173c4e7404ae914f85a19b91233ae0237608cbc3
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sun Jan 12 13:37:01 2014 +0100
use std::min and std::max
Change-Id: I5b8901606af2699a7d32978c897af73901fbc230
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 1288e72..980cd50 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -541,13 +541,11 @@ int OpenGLRender::SetLine2DShapePoint(float x, float y, int listLength)
m_Line2DPointList.push_back(actualX);
m_Line2DPointList.push_back(actualY);
m_Line2DPointList.push_back(m_fZStep);
- m_fPicLeft = actualX < m_fPicLeft ? actualX : m_fPicLeft;
- m_fPicRight = actualX > m_fPicRight ? actualX : m_fPicRight;
-
- m_fPicBottom = actualY < m_fPicBottom ? actualY : m_fPicBottom;
-
- m_fPicTop = actualY > m_fPicTop ? actualY : m_fPicTop;
+ m_fPicLeft = std::min(m_fPicLeft, actualX);
+ m_fPicRight = std::max(m_fPicRight, actualX);
+ m_fPicBottom = std::min(m_fPicBottom, actualY);
+ m_fPicTop = std::max(m_fPicTop, actualY);
if (m_Line2DPointList.size() == size_t((listLength * 3) - 1))
{
@@ -1274,13 +1272,11 @@ int OpenGLRender::Bubble2DShapePoint(float x, float y, float directionX, float d
m_Bubble2DPointList.xScale = directionX / 10.0f;
m_Bubble2DPointList.yScale = directionY / 10.0f;
- m_fPicLeft = actualX < m_fPicLeft ? actualX : m_fPicLeft;
-
- m_fPicRight = actualX > m_fPicRight ? actualX : m_fPicRight;
- m_fPicBottom = actualY < m_fPicBottom ? actualY : m_fPicBottom;
-
- m_fPicTop = actualY > m_fPicTop ? actualY : m_fPicTop;
+ m_fPicLeft = std::min(m_fPicLeft, actualX);
+ m_fPicRight = std::max(m_fPicRight, actualX);
+ m_fPicBottom = std::min(m_fPicBottom, actualY);
+ m_fPicTop = std::max(m_fPicTop, actualY);
m_Bubble2DShapePointList.push_back(m_Bubble2DPointList);
return 0;
@@ -1357,13 +1353,10 @@ int OpenGLRender::RectangleShapePoint(float x, float y, float directionX, float
m_RectangleList.xScale = directionX / OPENGL_SCALE_VALUE;
m_RectangleList.yScale = directionY / OPENGL_SCALE_VALUE;
- m_fPicLeft = actualX < m_fPicLeft ? actualX : m_fPicLeft;
-
- m_fPicRight = actualX > m_fPicRight ? actualX : m_fPicRight;
-
- m_fPicBottom = actualY < m_fPicBottom ? actualY : m_fPicBottom;
-
- m_fPicTop = actualY > m_fPicTop ? actualY : m_fPicTop;
+ m_fPicLeft = std::min(m_fPicLeft, actualX);
+ m_fPicRight = std::max(m_fPicRight, actualX);
+ m_fPicBottom = std::min(m_fPicBottom, actualY);
+ m_fPicTop = std::max(m_fPicTop, actualY);
m_RectangleShapePointList.push_back(m_RectangleList);
return 0;
@@ -1633,13 +1626,11 @@ int OpenGLRender::SetArea2DShapePoint(float x, float y, int listLength)
m_Area2DPointList.push_back(actualX);
m_Area2DPointList.push_back(actualY);
m_Area2DPointList.push_back(m_fZStep);
- m_fPicLeft = actualX < m_fPicLeft ? actualX : m_fPicLeft;
-
- m_fPicRight = actualX > m_fPicRight ? actualX : m_fPicRight;
-
- m_fPicBottom = actualY < m_fPicBottom ? actualY : m_fPicBottom;
- m_fPicTop = actualY > m_fPicTop ? actualY : m_fPicTop;
+ m_fPicLeft = std::min(m_fPicLeft, actualX);
+ m_fPicRight = std::max(m_fPicRight, actualX);
+ m_fPicBottom = std::min(m_fPicBottom, actualY);
+ m_fPicTop = std::max(m_fPicTop, actualY);
if (m_Area2DPointList.size() == size_t((listLength * 3) -1))
{
commit 6d02ca2b99a2acdc7d8d335d92c613411c8853bc
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sun Jan 12 13:33:51 2014 +0100
small fix for missed code
Change-Id: Ida611464603a8a6229b771380ce5c6b20aa268ef
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 3b3c621..1288e72 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -549,7 +549,7 @@ int OpenGLRender::SetLine2DShapePoint(float x, float y, int listLength)
m_fPicTop = actualY > m_fPicTop ? actualY : m_fPicTop;
- if (m_iPointNum == ((listLength * 3) - 1))
+ if (m_Line2DPointList.size() == size_t((listLength * 3) - 1))
{
m_Line2DShapePointList.push_back(m_Line2DPointList);
}
@@ -597,7 +597,6 @@ int OpenGLRender::RenderLine2FBO(int)
CHECK_GL_ERROR();
m_Line2DShapePointList.pop_front();
}
- m_iPointNum = 0;
GLenum status;
CHECK_GL_ERROR();
CHECK_GL_FRAME_BUFFER_STATUS();
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
index 492588b..159bccb 100644
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -91,6 +91,7 @@ typedef struct RectanglePointList
float xScale;
float yScale;
}RectanglePointList;
+
typedef struct TextInfo
{
GLuint texture;
@@ -258,8 +259,6 @@ private:
int m_iExternRC;
- int m_iPointNum;
-
Line2DPointList m_Line2DPointList;
int m_iFboIdx;
commit f16f007de64ebc9789090397f6426320a5d4b792
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sun Jan 12 13:30:45 2014 +0100
use std::vector instead of manual memory management
Change-Id: I021068716b0c3f4bc858eeb76da684dce316ba60
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index cd907ae1..3b3c621 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -909,7 +909,6 @@ OpenGLRender::OpenGLRender(uno::Reference< drawing::XShape > xTarget):
m_Line2DColor(glm::vec4(1.0, 0.0, 0.0, 1.0)),
m_iWidth(0),
m_iHeight(0),
- m_iPointNum(0),
m_iFboIdx(0),
m_fLineAlpha(1.0),
mxRenderTarget(xTarget),
@@ -922,7 +921,6 @@ OpenGLRender::OpenGLRender(uno::Reference< drawing::XShape > xTarget):
memset(&m_Bubble2DPointList, 0, sizeof(m_Bubble2DPointList));
memset(&m_Bubble2DCircle, 0, sizeof(m_Bubble2DCircle));
memset(&m_TextInfo, 0, sizeof(TextInfo));
- memset(&m_Area2DPointList, 0, sizeof(m_Area2DPointList));
memset(&m_RectangleList, 0, sizeof(RectanglePointList));
m_iFboIdx = 0;
@@ -1627,17 +1625,15 @@ int OpenGLRender::CreateBMPHeaderRGBA(sal_uInt8 *bmpHeader, int xsize, int ysize
int OpenGLRender::SetArea2DShapePoint(float x, float y, int listLength)
{
- if (!m_Area2DPointList.pointBuf)
+ if (m_Area2DPointList.empty())
{
- //a new point buffer should be alloc, we should push the old buffer first
- m_Area2DPointList.bufLen = listLength * sizeof(float) * 3;
- m_Area2DPointList.pointBuf = (float *)malloc(m_Area2DPointList.bufLen);
+ m_Area2DPointList.reserve(listLength);
}
float actualX = (x / OPENGL_SCALE_VALUE) - ((float)m_iWidth / 2);
float actualY = (y / OPENGL_SCALE_VALUE) - ((float)m_iHeight / 2);
- m_Area2DPointList.pointBuf[m_iPointNum++] = actualX;
- m_Area2DPointList.pointBuf[m_iPointNum++] = actualY;
- m_Area2DPointList.pointBuf[m_iPointNum++] = m_fZStep;
+ m_Area2DPointList.push_back(actualX);
+ m_Area2DPointList.push_back(actualY);
+ m_Area2DPointList.push_back(m_fZStep);
m_fPicLeft = actualX < m_fPicLeft ? actualX : m_fPicLeft;
m_fPicRight = actualX > m_fPicRight ? actualX : m_fPicRight;
@@ -1646,11 +1642,9 @@ int OpenGLRender::SetArea2DShapePoint(float x, float y, int listLength)
m_fPicTop = actualY > m_fPicTop ? actualY : m_fPicTop;
- if (m_iPointNum == (listLength * 3))
+ if (m_Area2DPointList.size() == size_t((listLength * 3) -1))
{
m_Area2DShapePointList.push_back(m_Area2DPointList);
- m_Area2DPointList.pointBuf = NULL;
- m_iPointNum = 0;
}
return 0;
}
@@ -1666,12 +1660,12 @@ int OpenGLRender::RenderArea2DShape()
PosVecf3 scale = {1.0f, 1.0f, 1.0f};
MoveModelf(trans, angle, scale);
m_MVP = m_Projection * m_View * m_Model;
- for (size_t i = 0; i < listNum; i++)
+ for (size_t i = 0; i < listNum; ++i)
{
Area2DPointList &pointList = m_Area2DShapePointList.front();
//fill vertex buffer
glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- glBufferData(GL_ARRAY_BUFFER, pointList.bufLen, pointList.pointBuf, GL_STATIC_DRAW);
+ glBufferData(GL_ARRAY_BUFFER, pointList.size() * sizeof(float), &pointList[0], GL_STATIC_DRAW);
// Use our shader
glUseProgram(m_CommonProID);
@@ -1690,11 +1684,10 @@ int OpenGLRender::RenderArea2DShape()
0, // stride
(void*)0 // array buffer offset
);
- glDrawArrays(GL_POLYGON, 0, pointList.bufLen / sizeof(float) / 3); // 12*3 indices starting at 0 -> 12 triangles
+ glDrawArrays(GL_POLYGON, 0, pointList.size() / 3); // 12*3 indices starting at 0 -> 12 triangles
glDisableVertexAttribArray(m_2DVertexID);
glUseProgram(0);
m_Area2DShapePointList.pop_front();
- free(pointList.pointBuf);
}
glEnable(GL_MULTISAMPLE);
m_fZStep += 0.01f;
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
index 75afa06..492588b 100644
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -100,11 +100,9 @@ typedef struct TextInfo
double rotation;
float vertex[8];
}TextInfo;
-typedef struct Area2DPointList
-{
- float *pointBuf;
- int bufLen;
-}Area2DPointList;
+
+typedef std::vector<float> Area2DPointList;
+
/// Holds the information of our new child window
struct GLWindow
{
commit f3e5836b18a1ee33b057f7a419fb097cd562d058
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sun Jan 12 13:29:39 2014 +0100
use std::vector instead of manual memory management
Change-Id: I17da6947caffde0ba10717475da36dd265069ce5
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index ebb7542..cd907ae1 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -532,18 +532,15 @@ BitmapEx OpenGLRender::GetAsBitmap()
int OpenGLRender::SetLine2DShapePoint(float x, float y, int listLength)
{
- if (!m_Line2DPointList.pointBuf)
+ if (m_Line2DPointList.empty())
{
- //a new point buffer should be alloc, we should push the old buffer first
- m_Line2DPointList.bufLen = listLength * sizeof(float) * 3;
- m_Line2DPointList.pointBuf = (float *)malloc(m_Line2DPointList.bufLen);
- m_iPointNum = 0;
+ m_Line2DPointList.reserve(listLength);
}
float actualX = (x / OPENGL_SCALE_VALUE) - ((float)m_iWidth / 2);
float actualY = (y / OPENGL_SCALE_VALUE) - ((float)m_iHeight / 2);
- m_Line2DPointList.pointBuf[m_iPointNum++] = actualX;
- m_Line2DPointList.pointBuf[m_iPointNum++] = actualY;
- m_Line2DPointList.pointBuf[m_iPointNum++] = m_fZStep;
+ m_Line2DPointList.push_back(actualX);
+ m_Line2DPointList.push_back(actualY);
+ m_Line2DPointList.push_back(m_fZStep);
m_fPicLeft = actualX < m_fPicLeft ? actualX : m_fPicLeft;
m_fPicRight = actualX > m_fPicRight ? actualX : m_fPicRight;
@@ -552,11 +549,9 @@ int OpenGLRender::SetLine2DShapePoint(float x, float y, int listLength)
m_fPicTop = actualY > m_fPicTop ? actualY : m_fPicTop;
- if (m_iPointNum == (listLength * 3))
+ if (m_iPointNum == ((listLength * 3) - 1))
{
m_Line2DShapePointList.push_back(m_Line2DPointList);
- m_Line2DPointList.pointBuf = NULL;
- m_iPointNum = 0;
}
return 0;
}
@@ -572,7 +567,7 @@ int OpenGLRender::RenderLine2FBO(int)
//fill vertex buffer
glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
CHECK_GL_ERROR();
- glBufferData(GL_ARRAY_BUFFER, pointList.bufLen, pointList.pointBuf, GL_STATIC_DRAW);
+ glBufferData(GL_ARRAY_BUFFER, pointList.size() * sizeof(float), &pointList[0], GL_STATIC_DRAW);
CHECK_GL_ERROR();
// Use our shader
glUseProgram(m_Line2DProID);
@@ -588,19 +583,18 @@ int OpenGLRender::RenderLine2FBO(int)
CHECK_GL_ERROR();
glVertexAttribPointer(
m_Line2DVertexID, // attribute. No particular reason for 0, but must match the layout in the shader.
- 2, // size
+ 3, // size
GL_FLOAT, // type
GL_FALSE, // normalized?
0, // stride
(void*)0 // array buffer offset
);
- glDrawArrays(GL_LINE_STRIP, 0, pointList.bufLen / sizeof(float) / 2); // 12*3 indices starting at 0 -> 12 triangles
+ glDrawArrays(GL_LINE_STRIP, 0, pointList.size()/3); // 12*3 indices starting at 0 -> 12 triangles
CHECK_GL_ERROR();
glDisableVertexAttribArray(m_Line2DWholeVertexID);
CHECK_GL_ERROR();
glUseProgram(0);
CHECK_GL_ERROR();
- free(pointList.pointBuf);
m_Line2DShapePointList.pop_front();
}
m_iPointNum = 0;
@@ -925,7 +919,6 @@ OpenGLRender::OpenGLRender(uno::Reference< drawing::XShape > xTarget):
m_ClearColor(glm::vec4(1.0f, 1.0f, 1.0f, 1.0f))
{
//TODO: moggi: use STL
- memset(&m_Line2DPointList, 0, sizeof(Line2DPointList));
memset(&m_Bubble2DPointList, 0, sizeof(m_Bubble2DPointList));
memset(&m_Bubble2DCircle, 0, sizeof(m_Bubble2DCircle));
memset(&m_TextInfo, 0, sizeof(TextInfo));
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
index 72c29a4..75afa06 100644
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -67,11 +67,7 @@ typedef struct PosVecf3
float z;
}PosVecf3;
-typedef struct Line2DPointList
-{
- float *pointBuf;;
- int bufLen;
-}Line2DPointList;
+typedef std::vector<float> Line2DPointList;
typedef struct Bubble2DPointList
{
commit 00bfea238c65d925153ab1f637e4bf83bc4ff837
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sat Jan 11 20:00:48 2014 +0100
I already know where the error is but want to be sure
Change-Id: Ibe90e99320243aadec2e2d8ab3740567e83f7f56
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 66b894a..ebb7542 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -571,15 +571,21 @@ int OpenGLRender::RenderLine2FBO(int)
Line2DPointList &pointList = m_Line2DShapePointList.front();
//fill vertex buffer
glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
+ CHECK_GL_ERROR();
glBufferData(GL_ARRAY_BUFFER, pointList.bufLen, pointList.pointBuf, GL_STATIC_DRAW);
+ CHECK_GL_ERROR();
// Use our shader
glUseProgram(m_Line2DProID);
+ CHECK_GL_ERROR();
glUniform4fv(m_Line2DColorID, 1, &m_Line2DColor[0]);
+ CHECK_GL_ERROR();
// 1rst attribute buffer : vertices
glEnableVertexAttribArray(m_Line2DVertexID);
+ CHECK_GL_ERROR();
glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
+ CHECK_GL_ERROR();
glVertexAttribPointer(
m_Line2DVertexID, // attribute. No particular reason for 0, but must match the layout in the shader.
2, // size
@@ -589,8 +595,11 @@ int OpenGLRender::RenderLine2FBO(int)
(void*)0 // array buffer offset
);
glDrawArrays(GL_LINE_STRIP, 0, pointList.bufLen / sizeof(float) / 2); // 12*3 indices starting at 0 -> 12 triangles
+ CHECK_GL_ERROR();
glDisableVertexAttribArray(m_Line2DWholeVertexID);
+ CHECK_GL_ERROR();
glUseProgram(0);
+ CHECK_GL_ERROR();
free(pointList.pointBuf);
m_Line2DShapePointList.pop_front();
}
commit 019c9adcb05cd15abdbeacad700168adcf64de7f
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sat Jan 11 19:42:49 2014 +0100
add a lot more debugging lines
Change-Id: I9b79845f5171c19c2b6f5214c9c307e0cfeaeec5
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 5184478..66b894a 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -563,6 +563,7 @@ int OpenGLRender::SetLine2DShapePoint(float x, float y, int listLength)
int OpenGLRender::RenderLine2FBO(int)
{
+ CHECK_GL_ERROR();
glLineWidth(m_fLineWidth);
size_t listNum = m_Line2DShapePointList.size();
for (size_t i = 0; i < listNum; i++)
@@ -595,6 +596,7 @@ int OpenGLRender::RenderLine2FBO(int)
}
m_iPointNum = 0;
GLenum status;
+ CHECK_GL_ERROR();
CHECK_GL_FRAME_BUFFER_STATUS();
return 0;
}
@@ -690,6 +692,7 @@ void OpenGLRender::renderToBitmap()
int OpenGLRender::RenderTexture2FBO(GLuint TexID)
{
+ CHECK_GL_ERROR();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glDepthMask(GL_FALSE);
glUseProgram(m_RenderProID);
@@ -721,6 +724,7 @@ int OpenGLRender::RenderTexture2FBO(GLuint TexID)
glBindTexture(GL_TEXTURE_2D, 0);
glUseProgram(0);
glDepthMask(GL_TRUE);
+ CHECK_GL_ERROR();
return 0;
}
@@ -1285,6 +1289,7 @@ int OpenGLRender::Bubble2DShapePoint(float x, float y, float directionX, float d
int OpenGLRender::RenderBubble2FBO(int)
{
+ CHECK_GL_ERROR();
size_t listNum = m_Bubble2DShapePointList.size();
for (size_t i = 0; i < listNum; i++)
{
@@ -1329,8 +1334,10 @@ int OpenGLRender::RenderBubble2FBO(int)
GLenum fbResult = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if( fbResult != GL_FRAMEBUFFER_COMPLETE )
{
+ SAL_WARN("chart2.opengl", "error");
return -1;
}
+ CHECK_GL_ERROR();
return 0;
}
@@ -1532,6 +1539,7 @@ int OpenGLRender::CreateTextTexture(::rtl::OUString textValue, sal_uInt32 color,
int OpenGLRender::RenderTextShape()
{
+ CHECK_GL_ERROR();
m_fZStep += 0.01f;
size_t listNum = m_TextInfoList.size();
for (size_t i = 0; i < listNum; i++)
@@ -1580,6 +1588,7 @@ int OpenGLRender::RenderTextShape()
glDeleteTextures(1, &textInfo.texture);
m_TextInfoList.pop_front();
}
+ CHECK_GL_ERROR();
return 0;
}
@@ -1646,6 +1655,8 @@ int OpenGLRender::SetArea2DShapePoint(float x, float y, int listLength)
int OpenGLRender::RenderArea2DShape()
{
+ CHECK_GL_ERROR();
+
glDisable(GL_MULTISAMPLE);
size_t listNum = m_Area2DShapePointList.size();
PosVecf3 trans = {0.0f, 0.0f, 0.0f};
@@ -1685,6 +1696,9 @@ int OpenGLRender::RenderArea2DShape()
}
glEnable(GL_MULTISAMPLE);
m_fZStep += 0.01f;
+
+ CHECK_GL_ERROR();
+
return 0;
}
commit f452b64ce0255266879850e24430f604a727a505
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sat Jan 11 19:36:00 2014 +0100
log the render calls
Change-Id: Ic502f5d7d8036b60364b32434ad95de1eb8879c8
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index 2c4a3e8..b55183e 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -372,6 +372,7 @@ DummyArea2D::DummyArea2D(const drawing::PointSequenceSequence& rShape):
void DummyArea2D::render()
{
+ SAL_WARN("chart2.opengl", "render DummyArea2D");
DummyChart* pChart = getRootShape();
sal_Int32 nPointssCount = maShapes.getLength();
for(sal_Int32 i = 0; i < nPointssCount; i++)
@@ -412,6 +413,7 @@ DummyCircle::DummyCircle(const awt::Point& rPos, const awt::Size& rSize)
void DummyCircle::render()
{
+ SAL_WARN("chart2.opengl", "render DummyCircle");
debugProperties(maProperties);
DummyChart* pChart = getRootShape();
std::map<OUString, uno::Any>::const_iterator itr = maProperties.find("FillColor");
@@ -566,6 +568,7 @@ DummyRectangle::DummyRectangle(const awt::Size& rSize, const awt::Point& rPoint,
void DummyRectangle::render()
{
+ SAL_WARN("chart2.opengl", "render DummyRectangle");
debugProperties(maProperties);
DummyChart* pChart = getRootShape();
std::map< OUString, uno::Any >::const_iterator itr = maProperties.find("FillColor");
@@ -650,6 +653,7 @@ private:
void DummyText::render()
{
+ SAL_WARN("chart2.opengl", "render DummyText");
debugProperties(maProperties);
Font aFont;
@@ -789,6 +793,7 @@ uno::Any DummyXShapes::getByIndex(sal_Int32 nIndex)
void DummyXShapes::render()
{
+ SAL_WARN("chart2.opengl", "render DummyShapes");
for(std::vector<DummyXShape*>::iterator itr = maShapes.begin(),
itrEnd = maShapes.end(); itr != itrEnd; ++itr)
{
@@ -1209,6 +1214,7 @@ void DummyChart::setSize( const awt::Size& aSize )
void DummyChart::render()
{
+ SAL_WARN("chart2.opengl", "render chart");
m_GLRender.prepareToRender();
DummyXShapes::render();
m_GLRender.renderToBitmap();
commit eedcf5c9f93dedffa61b7edf1497fc4385902b36
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sat Jan 11 19:32:15 2014 +0100
disable the logging of properties
Change-Id: I55709b7907af22883e9562ff1c846271743266ca
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index 777b02b..2c4a3e8 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -27,6 +27,8 @@
#include <algorithm>
+#define ENABLE_DEBUG_PROPERTIES 0
+
using namespace com::sun::star;
using namespace std;
@@ -39,10 +41,16 @@ namespace {
struct PrintProperties
{
+#if ENABLE_DEBUG_PROPERTIES
void operator()(const std::pair<OUString, uno::Any>& rProp)
{
SAL_WARN("chart2.opengl", "Property: " << rProp.first);
}
+#else
+ void operator()(const std::pair<OUString, uno::Any>&)
+ {
+ }
+#endif
};
void debugProperties(std::map<OUString, uno::Any>& rProperties)
commit 2dd2bb58e205cbefa0557a70c58a5697c6cfd51d
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sat Jan 11 19:25:34 2014 +0100
make sure it is really the glGenTextures call
that one is actually not allowed to create a GL_INVALID_OPERATION in
OpenGL 3.3+
Change-Id: I853c63cfd7a30d4f61e562082cc24959c0fe6c07
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index c1299e2..5184478 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -1509,6 +1509,7 @@ int OpenGLRender::CreateTextTexture(::rtl::OUString textValue, sal_uInt32 color,
}
+ CHECK_GL_ERROR();
glGenTextures(1, &m_TextInfo.texture);
CHECK_GL_ERROR();
glBindTexture(GL_TEXTURE_2D, m_TextInfo.texture);
commit d388490508c462a6252cff8201b90fd4d70cb559
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sat Jan 11 19:11:37 2014 +0100
improve error checking to find error on my machine
Change-Id: I24c0954342a66ba7d71d868ef8f04ed0cf7396a5
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index da55485..c1299e2 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -1510,14 +1510,21 @@ int OpenGLRender::CreateTextTexture(::rtl::OUString textValue, sal_uInt32 color,
}
glGenTextures(1, &m_TextInfo.texture);
+ CHECK_GL_ERROR();
glBindTexture(GL_TEXTURE_2D, m_TextInfo.texture);
+ CHECK_GL_ERROR();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
+ CHECK_GL_ERROR();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
+ CHECK_GL_ERROR();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ CHECK_GL_ERROR();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ CHECK_GL_ERROR();
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bmpWidth, bmpHeight, 0, GL_BGRA, GL_UNSIGNED_BYTE, bitmapBuf.get() + BMP_HEADER_LEN);
CHECK_GL_ERROR();
glBindTexture(GL_TEXTURE_2D, 0);
+ CHECK_GL_ERROR();
m_TextInfoList.push_back(m_TextInfo);
return 0;
}
More information about the Libreoffice-commits
mailing list