DirectRendering: 75/270675/25
authorAdam Bialogonski <adam.b@samsung.com>
Mon, 7 Feb 2022 14:38:56 +0000 (14:38 +0000)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 18 Mar 2022 18:41:07 +0000 (18:41 +0000)
- Added drawable-actor example

Change-Id: I991c7a28e5c97b56162e018aa0da72e4435c86bb

build/tizen/CMakeLists.txt
com.samsung.dali-demo.xml
examples-reel/dali-examples-reel.cpp
examples/drawable-actor/drawable-actor-example.cpp [new file with mode: 0644]
examples/drawable-actor/native-renderer.cpp [new file with mode: 0644]
examples/drawable-actor/native-renderer.h [new file with mode: 0644]
packaging/com.samsung.dali-demo.spec
resources/po/en_GB.po
resources/po/en_US.po
shared/dali-demo-strings.h

index e03c7fb..54ceab9 100644 (file)
@@ -337,6 +337,13 @@ ELSEIF( UNIX )
     ${REQUIRED_PKGS_LDFLAGS}
     -pie
   )
+
+  IF( ANDROID )
+    SET( REQUIRED_LIBS ${REQUIRED_LIBS} -lGLESv3 )
+  ELSE()
+    PKG_CHECK_MODULES( GLESV2 REQUIRED glesv2 )
+    SET( REQUIRED_LIBS ${REQUIRED_LIBS} ${GLESV2_LIBRARIES} )
+  ENDIF()
 ENDIF()
 
 SET(DALI_DEMO_CFLAGS "-DDEMO_GAME_DIR=${DEMO_GAME_DIR} -DDEMO_IMAGE_DIR=${DEMO_IMAGE_DIR} -DDEMO_VIDEO_DIR=${DEMO_VIDEO_DIR} -DDEMO_MODEL_DIR=${DEMO_MODEL_DIR} -DDEMO_SCRIPT_DIR=${DEMO_SCRIPT_DIR} -DDEMO_SHADER_DIR=${DEMO_SHADER_DIR}  -DDEMO_STYLE_DIR=${DEMO_STYLE_DIR} -DDEMO_THEME_PATH=${DEMO_THEME_PATH} -DDEMO_EXAMPLE_BIN=${DEMO_EXAMPLE_BIN} -DDEMO_LOCALE_DIR=${DEMO_LOCALE_DIR} -DDEMO_LANG=${DEMO_LANG} -DDEMO_DATA_RW_DIR=${DEMO_DATA_RW_DIR} -DDEMO_DATA_PUBLIC_RW_DIR=${DEMO_DATA_PUBLIC_RW_DIR} ")
index bfc1f6e..fa0f9ee 100644 (file)
        <ui-application appid="drag-and-drop.example" exec="/usr/apps/com.samsung.dali-demo/bin/drag-and-drop.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
                <label>Drag And Drop</label>
        </ui-application>
+       <ui-application appid="drawable-actor.example" exec="/usr/apps/com.samsung.dali-demo/bin/drawable-actor.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
+               <label>Drawable Actor</label>
+       </ui-application>
        <ui-application appid="effects-view.example" exec="/usr/apps/com.samsung.dali-demo/bin/effects-view.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
                <label>Effects View</label>
        </ui-application>
index 63ead6e..17fc2d7 100644 (file)
@@ -54,6 +54,7 @@ int DALI_EXPORT_API main(int argc, char** argv)
   demo.AddExample(Example("deferred-shading.example", DALI_DEMO_STR_TITLE_DEFERRED_SHADING));
   demo.AddExample(Example("dissolve-effect.example", DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION));
   demo.AddExample(Example("drag-and-drop.example", DALI_DEMO_STR_TITLE_DRAG_AND_DROP));
+  demo.AddExample(Example("drawable-actor.example", DALI_DEMO_STR_TITLE_DRAWABLE_ACTOR));
   demo.AddExample(Example("effects-view.example", DALI_DEMO_STR_TITLE_EFFECTS_VIEW));
   demo.AddExample(Example("flex-container.example", DALI_DEMO_STR_TITLE_FLEXBOX_PLAYGROUND));
   demo.AddExample(Example("frame-callback.example", DALI_DEMO_STR_TITLE_FRAME_CALLBACK));
diff --git a/examples/drawable-actor/drawable-actor-example.cpp b/examples/drawable-actor/drawable-actor-example.cpp
new file mode 100644 (file)
index 0000000..f8fc3db
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali/public-api/actors/drawable-actor.h>
+
+#include "native-renderer.h"
+
+// Include the GLES header
+#include <GLES3/gl3.h>
+#include <dali/graphics-api/graphics-buffer-create-info.h>
+
+#include <dali/devel-api/common/stage-devel.h>
+
+using TextLabel = Dali::Toolkit::TextLabel;
+using namespace Dali;
+
+// This example shows DrawableActor using native GL code to clear screen to red
+// and renders TextLabel on top of it.
+//
+class DrawableActorExampleController : public ConnectionTracker
+{
+public:
+
+  explicit DrawableActorExampleController(Application& application)
+    : mApplication(application)
+  {
+    // Connect to the Application's Init signal
+    mApplication.InitSignal().Connect(this, &DrawableActorExampleController::Create);
+  }
+
+  ~DrawableActorExampleController() override = default; // Nothing to do in destructor
+
+  // The Init signal is received once (only) during the Application lifetime
+  void Create(Application& application)
+  {
+    // Get a handle to the window
+    Window window = application.GetWindow();
+    window.SetBackgroundColor(Color::WHITE);
+
+    // Create native renderer
+    mRenderer = std::make_unique<NativeRenderer>(window.GetSize().GetWidth(), window.GetSize().GetHeight());
+
+    // Create render callback
+    mRenderCallback = RenderCallback::New<NativeRenderer>( mRenderer.get(), &NativeRenderer::OnRender );
+
+    // Create drawable actor
+    mGLActor = DrawableActor::New( *mRenderCallback );
+
+    mGLActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+    mGLActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+
+    // Set size on the actor (half the window size to show that glClear() and scissor test work together)
+    mGLActor.SetProperty( Actor::Property::SIZE, Size( window.GetSize() ) * 0.5f);
+
+    // Add actor to the scene
+    window.Add(mGLActor);
+
+    // Create TextLabel
+    mTextLabel = TextLabel::New("This text overlays DrawableActor");
+    mTextLabel.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+    mTextLabel.SetProperty(Dali::Actor::Property::NAME, "SomeTextLabel");
+    window.Add(mTextLabel);
+
+    // Respond to a touch anywhere on the window
+    window.GetRootLayer().TouchedSignal().Connect(this, &DrawableActorExampleController::OnTouch);
+
+    // Respond to key events
+    window.KeyEventSignal().Connect(this, &DrawableActorExampleController::OnKeyEvent);
+  }
+
+  bool OnTouch(Actor actor, const TouchEvent& touch)
+  {
+    // quit the application
+    mApplication.Quit();
+    return true;
+  }
+
+  void OnKeyEvent(const KeyEvent& event)
+  {
+    if(event.GetState() == KeyEvent::DOWN)
+    {
+      if(IsKey(event, Dali::DALI_KEY_ESCAPE) || IsKey(event, Dali::DALI_KEY_BACK))
+      {
+        mApplication.Quit();
+      }
+    }
+  }
+
+  TextLabel mTextLabel;
+  DrawableActor mGLActor;
+
+  std::unique_ptr<RenderCallback> mRenderCallback;
+  std::unique_ptr<NativeRenderer> mRenderer{nullptr};
+
+private:
+  Application& mApplication;
+};
+
+int DALI_EXPORT_API main(int argc, char** argv)
+{
+  Application          application = Application::New(&argc, &argv);
+  DrawableActorExampleController test(application);
+  application.MainLoop();
+  return 0;
+}
diff --git a/examples/drawable-actor/native-renderer.cpp b/examples/drawable-actor/native-renderer.cpp
new file mode 100644 (file)
index 0000000..82dbcaa
--- /dev/null
@@ -0,0 +1,308 @@
+//
+// Created by adam.b on 15/03/2022.
+//
+#include "native-renderer.h"
+
+/**
+ * Set of math helper functions
+ */
+namespace
+{
+
+constexpr GLfloat CUBE_VERTICES[] = {-1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f};
+
+constexpr GLfloat CUBE_COLOURS[] = {1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f};
+
+constexpr GLushort CUBE_INDICES[] = {0, 2, 3, 0, 1, 3, 4, 6, 7, 4, 5, 7, 8, 9, 10, 11, 8, 10, 12, 13, 14, 15, 12, 14, 16, 17, 18, 16, 19, 18, 20, 21, 22, 20, 23, 22};
+
+float matrixDegreesToRadians(float degrees)
+{
+  return M_PI * degrees / 180.0f;
+}
+
+[[maybe_unused]] void matrixIdentityFunction(float* matrix)
+{
+  if(matrix == NULL)
+  {
+    return;
+  }
+  matrix[0]  = 1.0f;
+  matrix[1]  = 0.0f;
+  matrix[2]  = 0.0f;
+  matrix[3]  = 0.0f;
+  matrix[4]  = 0.0f;
+  matrix[5]  = 1.0f;
+  matrix[6]  = 0.0f;
+  matrix[7]  = 0.0f;
+  matrix[8]  = 0.0f;
+  matrix[9]  = 0.0f;
+  matrix[10] = 1.0f;
+  matrix[11] = 0.0f;
+  matrix[12] = 0.0f;
+  matrix[13] = 0.0f;
+  matrix[14] = 0.0f;
+  matrix[15] = 1.0f;
+}
+
+[[maybe_unused]] void matrixMultiply(float* destination, float* operand1, float* operand2)
+{
+  float theResult[16];
+  int   i, j = 0;
+  for(i = 0; i < 4; i++)
+  {
+    for(j = 0; j < 4; j++)
+    {
+      theResult[4 * i + j] = operand1[j] * operand2[4 * i] + operand1[4 + j] * operand2[4 * i + 1] +
+                             operand1[8 + j] * operand2[4 * i + 2] + operand1[12 + j] * operand2[4 * i + 3];
+    }
+  }
+  for(int i = 0; i < 16; i++)
+  {
+    destination[i] = theResult[i];
+  }
+}
+
+[[maybe_unused]] void matrixTranslate(float* matrix, float x, float y, float z)
+{
+  float temporaryMatrix[16];
+  matrixIdentityFunction(temporaryMatrix);
+  temporaryMatrix[12] = x;
+  temporaryMatrix[13] = y;
+  temporaryMatrix[14] = z;
+  matrixMultiply(matrix, temporaryMatrix, matrix);
+}
+
+[[maybe_unused]] void matrixScale(float* matrix, float x, float y, float z)
+{
+  float tempMatrix[16];
+  matrixIdentityFunction(tempMatrix);
+  tempMatrix[0]  = x;
+  tempMatrix[5]  = y;
+  tempMatrix[10] = z;
+  matrixMultiply(matrix, tempMatrix, matrix);
+}
+
+[[maybe_unused]] void matrixRotateX(float* matrix, float angle)
+{
+  float tempMatrix[16];
+  matrixIdentityFunction(tempMatrix);
+  tempMatrix[5]  = cos(matrixDegreesToRadians(angle));
+  tempMatrix[9]  = -sin(matrixDegreesToRadians(angle));
+  tempMatrix[6]  = sin(matrixDegreesToRadians(angle));
+  tempMatrix[10] = cos(matrixDegreesToRadians(angle));
+  matrixMultiply(matrix, tempMatrix, matrix);
+}
+[[maybe_unused]] void matrixRotateY(float* matrix, float angle)
+{
+  float tempMatrix[16];
+  matrixIdentityFunction(tempMatrix);
+  tempMatrix[0]  = cos(matrixDegreesToRadians(angle));
+  tempMatrix[8]  = sin(matrixDegreesToRadians(angle));
+  tempMatrix[2]  = -sin(matrixDegreesToRadians(angle));
+  tempMatrix[10] = cos(matrixDegreesToRadians(angle));
+  matrixMultiply(matrix, tempMatrix, matrix);
+}
+[[maybe_unused]] void matrixRotateZ(float* matrix, float angle)
+{
+  float tempMatrix[16];
+  matrixIdentityFunction(tempMatrix);
+  tempMatrix[0] = cos(matrixDegreesToRadians(angle));
+  tempMatrix[4] = -sin(matrixDegreesToRadians(angle));
+  tempMatrix[1] = sin(matrixDegreesToRadians(angle));
+  tempMatrix[5] = cos(matrixDegreesToRadians(angle));
+  matrixMultiply(matrix, tempMatrix, matrix);
+}
+
+void matrixFrustum(float* matrix, float left, float right, float bottom, float top, float zNear, float zFar)
+{
+  float temp, xDistance, yDistance, zDistance;
+  temp      = 2.0 * zNear;
+  xDistance = right - left;
+  yDistance = top - bottom;
+  zDistance = zFar - zNear;
+  matrixIdentityFunction(matrix);
+  matrix[0]  = temp / xDistance;
+  matrix[5]  = temp / yDistance;
+  matrix[8]  = (right + left) / xDistance;
+  matrix[9]  = (top + bottom) / yDistance;
+  matrix[10] = (-zFar - zNear) / zDistance;
+  matrix[11] = -1.0f;
+  matrix[14] = (-temp * zFar) / zDistance;
+  matrix[15] = 0.0f;
+}
+
+[[maybe_unused]] void matrixPerspective(float* matrix, float fieldOfView, float aspectRatio, float zNear, float zFar)
+{
+  float ymax, xmax;
+  ymax = zNear * tanf(fieldOfView * M_PI / 360.0);
+  xmax = ymax * aspectRatio;
+  matrixFrustum(matrix, -xmax, xmax, -ymax, ymax, zNear, zFar);
+}
+
+} // namespace
+
+NativeRenderer::NativeRenderer(uint32_t width, uint32_t height)
+: mWidth(width),
+  mHeight(height)
+{
+}
+
+bool NativeRenderer::OnRender(const Dali::RenderCallbackInput& input)
+{
+  if(mState == State::INIT)
+  {
+    Setup(mWidth, mHeight);
+    mState = State::RENDER;
+  }
+
+  RenderCube(input);
+
+  return false;
+}
+
+void NativeRenderer::PrepareShader()
+{
+  static const char glVertexShader[] =
+    "attribute vec4 vertexPosition;\n"
+    "attribute vec3 vertexColour;\n"
+    "varying vec3 fragColour;\n"
+    "uniform mat4 projection;\n"
+    "uniform mat4 modelView;\n"
+    "void main()\n"
+    "{\n"
+    "    gl_Position = projection * modelView * vertexPosition;\n"
+    "    fragColour = vertexColour;\n"
+    "}\n";
+
+  static const char glFragmentShader[] =
+    "precision mediump float;\n"
+    "varying vec3 fragColour;\n"
+    "void main()\n"
+    "{\n"
+    "    gl_FragColor = vec4(fragColour, 1.0);\n"
+    "}\n";
+
+  mProgramId = CreateProgram(glVertexShader, glFragmentShader);
+}
+
+void NativeRenderer::Setup(int width, int height)
+{
+  PrepareShader();
+
+  mVertexLocation       = glGetAttribLocation(mProgramId, "vertexPosition");
+  mVertexColourLocation = glGetAttribLocation(mProgramId, "vertexColour");
+  mProjectionLocation   = glGetUniformLocation(mProgramId, "projection");
+  mModelViewLocation    = glGetUniformLocation(mProgramId, "modelView");
+
+  glEnable(GL_DEPTH_TEST);
+  glViewport(0, 0, width, height);
+}
+
+GLuint NativeRenderer::CreateProgram(const char* vertexSource, const char* fragmentSource)
+{
+  GLuint vertexShader = LoadShader(GL_VERTEX_SHADER, vertexSource);
+  if(!vertexShader)
+  {
+    return 0;
+  }
+  GLuint fragmentShader = LoadShader(GL_FRAGMENT_SHADER, fragmentSource);
+  if(!fragmentShader)
+  {
+    return 0;
+  }
+  GLuint program = glCreateProgram();
+  if(program)
+  {
+    glAttachShader(program, vertexShader);
+    glAttachShader(program, fragmentShader);
+    glLinkProgram(program);
+    GLint linkStatus = GL_FALSE;
+    glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
+    if(linkStatus != GL_TRUE)
+    {
+      GLint bufLength = 0;
+      glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength);
+      if(bufLength)
+      {
+        char* buf = (char*)malloc(bufLength);
+        if(buf)
+        {
+          glGetProgramInfoLog(program, bufLength, NULL, buf);
+          free(buf);
+        }
+      }
+      glDeleteProgram(program);
+      program = 0;
+    }
+  }
+  return program;
+}
+
+GLuint NativeRenderer::LoadShader(GLenum shaderType, const char* shaderSource)
+{
+  GLuint shader = glCreateShader(shaderType);
+  if(shader != 0)
+  {
+    glShaderSource(shader, 1, &shaderSource, NULL);
+    glCompileShader(shader);
+    GLint compiled = 0;
+    glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
+    if(compiled != GL_TRUE)
+    {
+      GLint infoLen = 0;
+      glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
+
+      if(infoLen > 0)
+      {
+        char* logBuffer = (char*)malloc(infoLen);
+
+        if(logBuffer != NULL)
+        {
+          glGetShaderInfoLog(shader, infoLen, NULL, logBuffer);
+          free(logBuffer);
+          logBuffer = NULL;
+        }
+
+        glDeleteShader(shader);
+        shader = 0;
+      }
+    }
+  }
+
+  return shader;
+}
+
+void NativeRenderer::RenderCube(const Dali::RenderCallbackInput& input)
+{
+  static float angle = 0.0f;
+
+  auto x = float(mWidth - input.size.width) * 0.5f;
+  auto y = float(mHeight - input.size.height) * 0.5f;
+  auto w = input.size.width;
+  auto h = input.size.height;
+
+  matrixPerspective(mProjectionMatrix, 45, (float)w / (float)h, 0.1f, 100);
+
+  glEnable(GL_SCISSOR_TEST);
+  glScissor(x, y, w, h);
+  glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
+  glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
+  matrixIdentityFunction(mModelViewMatrix);
+  matrixScale(mModelViewMatrix, 0.5f, 0.5f, 0.5f);
+  matrixRotateX(mModelViewMatrix, angle);
+  matrixRotateY(mModelViewMatrix, angle);
+  matrixTranslate(mModelViewMatrix, 0.0f, 0.0f, -10.0f);
+  glUseProgram(mProgramId);
+  glVertexAttribPointer(mVertexLocation, 3, GL_FLOAT, GL_FALSE, 0, CUBE_VERTICES);
+  glEnableVertexAttribArray(mVertexLocation);
+  glVertexAttribPointer(mVertexColourLocation, 3, GL_FLOAT, GL_FALSE, 0, CUBE_COLOURS);
+  glEnableVertexAttribArray(mVertexColourLocation);
+  glUniformMatrix4fv(mProjectionLocation, 1, GL_FALSE, mProjectionMatrix);
+  glUniformMatrix4fv(mModelViewLocation, 1, GL_FALSE, mModelViewMatrix);
+  glDrawElements(GL_TRIANGLES, 36, GL_UNSIGNED_SHORT, CUBE_INDICES);
+  angle += 1;
+  if(angle > 360)
+  {
+    angle -= 360;
+  }
+}
diff --git a/examples/drawable-actor/native-renderer.h b/examples/drawable-actor/native-renderer.h
new file mode 100644 (file)
index 0000000..2227c85
--- /dev/null
@@ -0,0 +1,79 @@
+#ifndef DALI_PROJECT_NATIVE_RENDERER_H
+#define DALI_PROJECT_NATIVE_RENDERER_H
+
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/**
+ * This is demo that doesn't use DALi directly as if it's
+ * a separate non-DALi app (so not using DALi math etc.)
+ */
+
+#include <dali/public-api/signals/render-callback.h>
+
+#include <cmath>
+#include <GLES3/gl3.h>
+
+class NativeRenderer
+{
+public:
+
+  NativeRenderer( uint32_t width, uint32_t height);
+
+  bool OnRender( const Dali::RenderCallbackInput& input );
+
+  void PrepareShader();
+
+  void Setup( int width, int height);
+
+  void RenderCube( const Dali::RenderCallbackInput& input );
+
+  /**
+   * Creates GL program from shader sources
+   */
+  GLuint CreateProgram(const char* vertexSource, const char* fragmentSource);
+
+  /**
+   * Loads shader
+   */
+  GLuint LoadShader(GLenum shaderType, const char* shaderSource);
+
+  enum class State
+  {
+    INIT,
+    RENDER
+  };
+
+private:
+
+  State mState {State::INIT};
+
+  GLuint mProgramId{0u};
+
+  GLint mVertexLocation{};
+  GLint mVertexColourLocation{};
+  GLint mProjectionLocation{};
+  GLint mModelViewLocation{};
+
+  float mModelViewMatrix[16];
+  float mProjectionMatrix[16];
+
+  uint32_t mWidth;
+  uint32_t mHeight;
+};
+
+#endif // DALI_PROJECT_NATIVE_RENDERER_H
index b0a5286..fd607f6 100755 (executable)
@@ -24,6 +24,8 @@ BuildRequires:  pkgconfig(dali2-adaptor)
 BuildRequires:  pkgconfig(dali2-toolkit)
 BuildRequires:  pkgconfig(dali2-scene-loader)
 BuildRequires:  pkgconfig(libtzplatform-config)
+BuildRequires:  pkgconfig(gles20)
+BuildRequires:  pkgconfig(glesv2)
 
 %description
 The OpenGLES Canvas Core Demo is a collection of examples and demonstrations
index 6207632..fb46dfe 100755 (executable)
@@ -79,6 +79,9 @@ msgstr "Dissolve Effect"
 msgid "DALI_DEMO_STR_TITLE_DRAG_AND_DROP"
 msgstr "Drag and Drop"
 
+msgid "DALI_DEMO_STR_TITLE_DRAWABLE_ACTOR"
+msgstr "DrawableActor"
+
 msgid "DALI_DEMO_STR_TITLE_EFFECTS_VIEW"
 msgstr "Effects View"
 
index 1c5dcc2..cda3cf6 100755 (executable)
@@ -79,6 +79,9 @@ msgstr "Dissolve Effect"
 msgid "DALI_DEMO_STR_TITLE_DRAG_AND_DROP"
 msgstr "Drag and Drop"
 
+msgid "DALI_DEMO_STR_TITLE_DRAWABLE_ACTOR"
+msgstr "DrawableActor"
+
 msgid "DALI_DEMO_STR_TITLE_EFFECTS_VIEW"
 msgstr "Effects View"
 
index f4b7a6b..b9b283f 100644 (file)
@@ -62,6 +62,7 @@ extern "C"
 #define DALI_DEMO_STR_TITLE_CUBE_TRANSITION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CUBE_TRANSITION")
 #define DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION")
 #define DALI_DEMO_STR_TITLE_DRAG_AND_DROP dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_DRAG_AND_DROP")
+#define DALI_DEMO_STR_TITLE_DRAWABLE_ACTOR dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_DRAWABLE_ACTOR")
 #define DALI_DEMO_STR_TITLE_EFFECTS_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_EFFECTS_VIEW")
 #define DALI_DEMO_STR_TITLE_EMOJI_TEXT dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_EMOJI_TEXT")
 #define DALI_DEMO_STR_TITLE_FPP_GAME dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_FPP_GAME")
@@ -170,6 +171,7 @@ extern "C"
 #define DALI_DEMO_STR_TITLE_DEFERRED_SHADING "Deferred Shading"
 #define DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION "Dissolve Effect"
 #define DALI_DEMO_STR_TITLE_DRAG_AND_DROP "Drag and Drop"
+#define DALI_DEMO_STR_TITLE_DRAWABLE_ACTOR "DrawableActor"
 #define DALI_DEMO_STR_TITLE_EFFECTS_VIEW "Effects View"
 #define DALI_DEMO_STR_TITLE_EMOJI_TEXT "Emoji Text"
 #define DALI_DEMO_STR_TITLE_FPP_GAME "First Person Game"