* @brief Process a render-list.
* @param[in] renderList The render-list to process.
* @param[in] context The GL context.
- * @param[in] defaultShader The default shader to use.
* @param[in] buffer The current render buffer index (previous update buffer)
* @param[in] viewMatrix The view matrix from the appropriate camera.
* @param[in] projectionMatrix The projection matrix from the appropriate camera.
inline void ProcessRenderList(
const RenderList& renderList,
Context& context,
- SceneGraph::Shader& defaultShader,
BufferIndex bufferIndex,
const Matrix& viewMatrix,
const Matrix& projectionMatrix )
item.mRenderer->Render( context,
bufferIndex,
*item.mNode,
- defaultShader,
item.mModelMatrix,
item.mModelViewMatrix,
viewMatrix,
void ProcessRenderInstruction( const RenderInstruction& instruction,
Context& context,
- SceneGraph::Shader& defaultShader,
BufferIndex bufferIndex )
{
DALI_PRINT_RENDER_INSTRUCTION( instruction, bufferIndex );
{
ProcessRenderList( *renderList,
context,
- defaultShader,
bufferIndex,
*viewMatrix,
*projectionMatrix );
textureContainer(),
frameBufferContainer(),
renderersAdded( false ),
- firstRenderCompleted( false ),
- defaultShader( NULL ),
programController( glAbstraction )
{
}
RenderTrackerContainer mRenderTrackers; ///< List of render trackers
- bool firstRenderCompleted; ///< False until the first render is done
- Shader* defaultShader; ///< Default shader to use
ProgramController programController; ///< Owner of the GL programs
};
mImpl->RemoveRenderTracker(renderTracker);
}
-void RenderManager::SetDefaultShader( Shader* shader )
-{
- mImpl->defaultShader = shader;
-}
-
ProgramCache* RenderManager::GetProgramCache()
{
return &(mImpl->programController);
// Process messages queued during previous update
mImpl->renderQueue.ProcessMessages( mImpl->renderBufferIndex );
- // No need to make any gl calls if we've done 1st glClear & don't have any renderers to render during startup.
- if( !mImpl->firstRenderCompleted || mImpl->renderersAdded )
+ // switch rendering to adaptor provided (default) buffer
+ mImpl->context.BindFramebuffer( GL_FRAMEBUFFER, 0 );
+
+ mImpl->context.Viewport( mImpl->defaultSurfaceRect.x,
+ mImpl->defaultSurfaceRect.y,
+ mImpl->defaultSurfaceRect.width,
+ mImpl->defaultSurfaceRect.height );
+
+ mImpl->context.ClearColor( mImpl->backgroundColor.r,
+ mImpl->backgroundColor.g,
+ mImpl->backgroundColor.b,
+ mImpl->backgroundColor.a );
+
+ mImpl->context.ClearStencil( 0 );
+
+ // Clear the entire color, depth and stencil buffers for the default framebuffer.
+ // It is important to clear all 3 buffers, for performance on deferred renderers like Mali
+ // e.g. previously when the depth & stencil buffers were NOT cleared, it caused the DDK to exceed a "vertex count limit",
+ // and then stall. That problem is only noticeable when rendering a large number of vertices per frame.
+ mImpl->context.SetScissorTest( false );
+ mImpl->context.ColorMask( true );
+ mImpl->context.DepthMask( true );
+ mImpl->context.StencilMask( 0xFF ); // 8 bit stencil mask, all 1's
+ mImpl->context.Clear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT, Context::FORCE_CLEAR );
+
+ // reset the program matrices for all programs once per frame
+ // this ensures we will set view and projection matrix once per program per camera
+ mImpl->programController.ResetProgramMatrices();
+
+ size_t count = mImpl->instructions.Count( mImpl->renderBufferIndex );
+ for ( size_t i = 0; i < count; ++i )
{
- // switch rendering to adaptor provided (default) buffer
- mImpl->context.BindFramebuffer( GL_FRAMEBUFFER, 0 );
-
- mImpl->context.Viewport( mImpl->defaultSurfaceRect.x,
- mImpl->defaultSurfaceRect.y,
- mImpl->defaultSurfaceRect.width,
- mImpl->defaultSurfaceRect.height );
-
- mImpl->context.ClearColor( mImpl->backgroundColor.r,
- mImpl->backgroundColor.g,
- mImpl->backgroundColor.b,
- mImpl->backgroundColor.a );
-
- mImpl->context.ClearStencil( 0 );
-
- // Clear the entire color, depth and stencil buffers for the default framebuffer.
- // It is important to clear all 3 buffers, for performance on deferred renderers like Mali
- // e.g. previously when the depth & stencil buffers were NOT cleared, it caused the DDK to exceed a "vertex count limit",
- // and then stall. That problem is only noticeable when rendering a large number of vertices per frame.
- mImpl->context.SetScissorTest( false );
- mImpl->context.ColorMask( true );
- mImpl->context.DepthMask( true );
- mImpl->context.StencilMask( 0xFF ); // 8 bit stencil mask, all 1's
- mImpl->context.Clear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT, Context::FORCE_CLEAR );
-
- // reset the program matrices for all programs once per frame
- // this ensures we will set view and projection matrix once per program per camera
- mImpl->programController.ResetProgramMatrices();
-
- // if we don't have default shader, no point doing the render calls
- if( mImpl->defaultShader )
- {
- size_t count = mImpl->instructions.Count( mImpl->renderBufferIndex );
- for ( size_t i = 0; i < count; ++i )
- {
- RenderInstruction& instruction = mImpl->instructions.At( mImpl->renderBufferIndex, i );
+ RenderInstruction& instruction = mImpl->instructions.At( mImpl->renderBufferIndex, i );
- DoRender( instruction, *mImpl->defaultShader );
- }
- GLenum attachments[] = { GL_DEPTH, GL_STENCIL };
- mImpl->context.InvalidateFramebuffer(GL_FRAMEBUFFER, 2, attachments);
-
- mImpl->UpdateTrackers();
-
- mImpl->firstRenderCompleted = true;
- }
+ DoRender( instruction );
}
+ GLenum attachments[] = { GL_DEPTH, GL_STENCIL };
+ mImpl->context.InvalidateFramebuffer(GL_FRAMEBUFFER, 2, attachments);
+
+ mImpl->UpdateTrackers();
//Notify RenderGeometries that rendering has finished
for ( GeometryOwnerIter iter = mImpl->geometryContainer.Begin(); iter != mImpl->geometryContainer.End(); ++iter )
return false;
}
-void RenderManager::DoRender( RenderInstruction& instruction, Shader& defaultShader )
+void RenderManager::DoRender( RenderInstruction& instruction )
{
Rect<int> viewportRect;
Vector4 clearColor;
Render::ProcessRenderInstruction( instruction,
mImpl->context,
- defaultShader,
mImpl->renderBufferIndex );
if( instruction.mRenderTracker && ( instruction.mFrameBuffer != NULL ) )