avoid transferring the textures for each frame

Change-Id: I79466e66dc18dbbf72f192fe44d05fb6d657fa34
This commit is contained in:
Markus Mohrhard
2014-05-28 18:51:38 +02:00
committed by Markus Mohrhard
parent 8287ee51e9
commit a45b16602f
4 changed files with 20 additions and 8 deletions

View File

@@ -35,7 +35,8 @@ GL3DBarChart::GL3DBarChart(
mnStep(0),
mnStepsTotal(0),
mnCornerId(0),
mbBlockUserInput(false)
mbBlockUserInput(false),
mbNeedsNewRender(true)
{
Size aSize = mrWindow.GetSizePixel();
mpRenderer->SetSize(aSize);
@@ -93,6 +94,7 @@ double findMaxValue(const boost::ptr_vector<VDataSeries>& rDataSeriesContainer)
void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSeriesContainer,
ExplicitCategoriesProvider& rCatProvider)
{
mpRenderer->ReleaseShapes();
// Each series of data flows from left to right, and multiple series are
// stacked vertically along y axis.
@@ -269,6 +271,8 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
mpCamera->setPosition(maCameraPosition);
maCameraDirection = glm::vec3(mnMaxX/2, mnMaxY/2, 0);
mpCamera->setDirection(maCameraDirection);
mbNeedsNewRender = true;
}
void GL3DBarChart::render()
@@ -280,11 +284,19 @@ void GL3DBarChart::render()
Size aSize = mrWindow.GetSizePixel();
mpRenderer->SetSize(aSize);
mrWindow.getContext()->setWinSize(aSize);
for(boost::ptr_vector<opengl3D::Renderable3DObject>::iterator itr = maShapes.begin(),
itrEnd = maShapes.end(); itr != itrEnd; ++itr)
if(mbNeedsNewRender)
{
itr->render();
for(boost::ptr_vector<opengl3D::Renderable3DObject>::iterator itr = maShapes.begin(),
itrEnd = maShapes.end(); itr != itrEnd; ++itr)
{
itr->render();
}
}
else
{
mpCamera->render();
}
mbNeedsNewRender = false;
mpRenderer->ProcessUnrenderedShape();
mrWindow.getContext()->swapBuffers();
}

View File

@@ -105,6 +105,7 @@ private:
std::map<sal_uInt32, const BarInformation> maBarMap;
bool mbBlockUserInput;
bool mbNeedsNewRender;
};
}

View File

@@ -184,6 +184,9 @@ public:
void SetPickingMode(bool bPickingMode);
sal_uInt32 GetPixelColorFromPoint(long nX, long nY);
void ReleaseShapes();
void ReleaseScreenTextShapes();
private:
void MoveModelf(PosVecf3& trans,PosVecf3& angle,PosVecf3& scale);
@@ -219,11 +222,9 @@ private:
int iSubDivZ, float width, float height, float depth);
void CreateSceneBoxView();
void ReleaseShapes();
void ReleasePolygonShapes();
void ReleaseExtrude3DShapes();
void ReleaseTextShapes();
void ReleaseScreenTextShapes();
void ReleaseBatchBarInfo();
void GetBatchBarsInfo();
void GetBatchTopAndFlatInfo(Extrude3DInfo &extrude3D);

View File

@@ -1711,7 +1711,6 @@ void OpenGL3DRenderer::ProcessUnrenderedShape()
RenderTextShape();
// render screen text
RenderScreenTextShape();
ReleaseShapes();
#if DEBUG_FBO
OUString aFileName = OUString("D://shaderout_") + OUString::number(m_iWidth) + "_" + OUString::number(m_iHeight) + ".png";
OpenGLHelper::renderToFile(m_iWidth, m_iHeight, aFileName);
@@ -1762,7 +1761,6 @@ void OpenGL3DRenderer::ReleaseBatchBarInfo()
}
}
void OpenGL3DRenderer::ReleaseShapes()
{
ReleasePolygonShapes();