Added property to Renderer to specify the depth function
[platform/core/uifw/dali-core.git] / dali / internal / render / gl-resources / context.cpp
index 2112488..be82555 100644 (file)
@@ -20,6 +20,7 @@
 
 // EXTERNAL INCLUDES
 #include <algorithm>
+#include <cstring>
 
 // INTERNAL INCLUDES
 #include <dali/public-api/common/constants.h>
@@ -27,7 +28,7 @@
 #include <dali/integration-api/platform-abstraction.h>
 #include <dali/integration-api/debug.h>
 #include <dali/internal/render/common/render-manager.h>
-#include <dali/devel-api/rendering/material.h>
+#include <dali/devel-api/rendering/texture-set.h>
 
 namespace Dali
 {
@@ -90,13 +91,11 @@ Context::Context(Integration::GlAbstraction& glAbstraction)
   mBlendFuncSeparateDstAlpha(GL_ZERO),
   mBlendEquationSeparateModeRGB( GL_FUNC_ADD ),
   mBlendEquationSeparateModeAlpha( GL_FUNC_ADD ),
+  mDepthFunction( GL_LESS ),
   mMaxTextureSize(0),
   mClearColor(Color::WHITE),    // initial color, never used until it's been set by the user
-  mCullFaceMode( Dali::Material::NONE ),
-  mViewPort( 0, 0, 0, 0 ),
-  mFrameCount( 0 ),
-  mCulledCount( 0 ),
-  mRendererCount( 0 )
+  mCullFaceMode( FaceCullingMode::NONE ),
+  mViewPort( 0, 0, 0, 0 )
 {
 }
 
@@ -229,7 +228,7 @@ void Context::InitializeGlState()
   mBlendEquationSeparateModeRGB = GL_FUNC_ADD;
   mBlendEquationSeparateModeAlpha = GL_FUNC_ADD;
 
-  mCullFaceMode = Dali::Material::NONE; //By default cullface is disabled, front face is set to CCW and cull face is set to back
+  mCullFaceMode = FaceCullingMode::NONE; //By default cullface is disabled, front face is set to CCW and cull face is set to back
 
   // get maximum texture size
   mGlAbstraction.GetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize);
@@ -237,6 +236,13 @@ void Context::InitializeGlState()
   // reset viewport, this will be set to something useful when rendering
   mViewPort.x = mViewPort.y = mViewPort.width = mViewPort.height = 0;
 
+  //Initialze vertex attribute cache
+  memset( &mVertexAttributeCachedState, 0, sizeof(mVertexAttributeCachedState) );
+  memset( &mVertexAttributeCurrentState, 0, sizeof(mVertexAttributeCurrentState) );
+
+  //Initialize bound 2d texture cache
+  memset( &mBound2dTextureId, 0, sizeof(mBound2dTextureId) );
+
   mFrameBufferStateCache.Reset();
 }