[SDL/OpenGL ES] Add 4.0 new features guide 21/146921/4
authorhuiyu,eun <huiyu.eun@samsung.com>
Thu, 31 Aug 2017 06:12:27 +0000 (15:12 +0900)
committerEditor Lionbridge <TizenEditor.SEL@lionbridge.com>
Tue, 5 Sep 2017 09:05:33 +0000 (12:05 +0300)
  - Refer [ACR-937]Add opengl es APIs and [ACR-1017]Add new SDL APIs
  - SDL with OpenGL ES is supported in both mobile applications and wearable applications in Tizen 4.0.
  - SDL with Vulkan is supported in mobile applications in Tizen 3.0.

PS3: Reviewed
PS4: Query answers implemented, a few typos and link issues fixed

Change-Id: I7e94039a6a7c968791cd56fbb0beddfff0cf1e8b
Signed-off-by: huiyu,eun <huiyu.eun@samsung.com>
12 files changed:
org.tizen.guides/html/images/sdl_in_tizen.png [new file with mode: 0755]
org.tizen.guides/html/images/sdl_opengles.png [new file with mode: 0755]
org.tizen.guides/html/images/sdl_statemodel.png
org.tizen.guides/html/images/vulkan_framework.png
org.tizen.guides/html/index.htm
org.tizen.guides/html/native/device/system_n.htm
org.tizen.guides/html/native/graphics/graphics_cover_n.htm
org.tizen.guides/html/native/graphics/sdl_n.htm [new file with mode: 0644]
org.tizen.guides/html/native/graphics/sdl_opengles_n.htm [new file with mode: 0644]
org.tizen.guides/html/native/graphics/vulkan_n.htm
org.tizen.guides/index.xml
org.tizen.training/html/native/details/app_filtering_n.htm

diff --git a/org.tizen.guides/html/images/sdl_in_tizen.png b/org.tizen.guides/html/images/sdl_in_tizen.png
new file mode 100755 (executable)
index 0000000..7798a7c
Binary files /dev/null and b/org.tizen.guides/html/images/sdl_in_tizen.png differ
diff --git a/org.tizen.guides/html/images/sdl_opengles.png b/org.tizen.guides/html/images/sdl_opengles.png
new file mode 100755 (executable)
index 0000000..f324d7a
Binary files /dev/null and b/org.tizen.guides/html/images/sdl_opengles.png differ
index 0af6b30..0a17195 100755 (executable)
Binary files a/org.tizen.guides/html/images/sdl_statemodel.png and b/org.tizen.guides/html/images/sdl_statemodel.png differ
index 8045554..6065468 100755 (executable)
Binary files a/org.tizen.guides/html/images/vulkan_framework.png and b/org.tizen.guides/html/images/vulkan_framework.png differ
index 7ec898f..b81612e 100644 (file)
                                                <li><a href="native/graphics/adv_performance_n.htm" target="content">Advanced Performance</a></li>
                                        </ul>
                                </li>
-                               <li><a href="native/graphics/vulkan_n.htm" target="content">SDL Graphics with Vulkan&reg;</a></li>
+                               <li><a href="native/graphics/sdl_n.htm" target="content">Simple DirectMedia Layer (SDL)</a>
+                                       <ul>
+                                               <li><a href="native/graphics/vulkan_n.htm" target="content">SDL Graphics with Vulkan&reg;</a></li>
+                                               <li><a href="native/graphics/sdl_opengles_n.htm" target="content">SDL Graphics with OpenGL&reg; ES</a></li>
+                                       </ul>
+                               </li>
                        </ul>
                </li>
                <li><a href="native/notification/notification_cover_n.htm" target="content">Notifications and Content Sharing</a>
index 32f36d5..4829232 100644 (file)
@@ -945,6 +945,16 @@ the Tizen reference implementation.</td>
      <td><code>bool</code></td>
       <td>The platform returns <code>true</code> for this key and the <code>http://tizen.org/feature/opengles</code> key, if the device supports the OpenGL&reg; ES version 3.0.</td>
     </tr>
+    <tr>
+     <td><code>http://tizen.org/feature/opengles.version.3_1</code></td>
+     <td><code>bool</code></td>
+      <td>The platform returns <code>true</code> for this key and the <code>http://tizen.org/feature/opengles</code> key, if the device supports the OpenGL&reg; ES version 3.1.</td>
+    </tr>
+    <tr>
+     <td><code>http://tizen.org/feature/opengles.version.3_2</code></td>
+     <td><code>bool</code></td>
+      <td>The platform returns <code>true</code> for this key and the <code>http://tizen.org/feature/opengles</code> key, if the device supports the OpenGL&reg; ES version 3.2.</td>
+    </tr>
    </tbody>
   </table>
 <p>The following table lists the platform feature keys.</p>
index a790508..ae63725 100644 (file)
@@ -57,8 +57,8 @@
 
 <p>You can create OpenGL&reg; ES applications in Tizen with the EGL&trade; layer. Tizen native applications can use OpenGL&reg; ES not only for creating a 3D scene but also for a 2D scene that requires fast interaction. OpenGL&reg; ES is also good for improving performance and reducing power consumption when the native application performs computation-intensive tasks that can be run in parallel.</p></li>
 
-<li><a href="vulkan_n.htm">SDL Graphics with Vulkan&reg;</a>
-<p>You can get high-efficiency access to graphics and computing on modern GPUs with Vulkan&reg;. You can use cutting-edge 3D programming tools to create high-quality games and real-time graphics in your applications.</p></li>
+<li><a href="sdl_n.htm">Simple DirectMedia Layer (SDL)</a>
+<p>Simple DirectMedia Layer (SDL) is a cross-platform development library designed to provide a low-level hardware abstraction layer to computer multimedia hardware components. You can get high-efficiency access to graphics and computing on modern GPUs with Vulkan&reg; or OpenGL&reg; ES. You can use cutting-edge 3D programming tools to create high-quality games and real-time graphics in your applications.</p></li>
 </ul>
 
 <script type="text/javascript" src="../../scripts/jquery.zclip.min.js"></script>
diff --git a/org.tizen.guides/html/native/graphics/sdl_n.htm b/org.tizen.guides/html/native/graphics/sdl_n.htm
new file mode 100644 (file)
index 0000000..cf83310
--- /dev/null
@@ -0,0 +1,455 @@
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+    <meta http-equiv="X-UA-Compatible" content="IE=9" />
+    <link rel="stylesheet" type="text/css" href="../../css/styles.css" />
+    <link rel="stylesheet" type="text/css" href="../../css/snippet.css" />
+    <script type="text/javascript" src="../../scripts/snippet.js"></script>
+    <script type="text/javascript" src="../../scripts/jquery.util.js" charset="utf-8"></script>
+    <script type="text/javascript" src="../../scripts/common.js" charset="utf-8"></script>
+    <script type="text/javascript" src="../../scripts/core.js" charset="utf-8"></script>
+    <script type="text/javascript" src="../../scripts/search.js" charset="utf-8"></script>
+  <title>Simple DirectMedia Layer (SDL)</title>
+ </head>
+ <body onload="prettyPrint()" style="overflow: auto;">
+
+ <div id="toc-navigation">
+    <div id="profile">
+        <p><img alt="Mobile native" src="../../images/mobile_s_n.png"/> <img alt="Wearable native" src="../../images/wearable_s_n.png"/></p>
+    </div>
+
+       <div id="toc_border"><div id="toc">
+               <p class="toc-title">Dependencies</p>
+               <ul class="toc">
+                       <li>Tizen 3.0 and Higher for Mobile</li>
+                       <li>Tizen 3.0 and Higher for Wearable</li>
+               </ul>
+        <p class="toc-title">Content</p>
+        <ul class="toc">
+                       <li><a href="#vulkan_vs_opengles">Vulkan&reg; vs. OpenGL&reg;</a></li>
+                       <li><a href="#lifecycle">SDL Application Life-cycle in Tizen</a></li>
+                       <li><a href="#prerequisites">Prerequisites</a></li>
+                       <li><a href="#SDL_event">Handling General SDL Events</a></li>
+                       <li><a href="#tizen_event">Handling Tizen-specific SDL Events</a></li>
+                       <li><a href="#screen_orientation">Handling Screen Orientation</a></li>
+                       <li><a href="#setting_indicator">Showing the Status Bar</a></li>
+               </ul>
+        <p class="toc-title">Related Info</p>
+        <ul class="toc">
+                       <li><a href="../../../../org.tizen.native.mobile.apireference/group__OPENSRC__SDL__FRAMEWORK.html">SDL API for Mobile Native</a></li>
+                       <li><a href="../../../../org.tizen.native.wearable.apireference/group__OPENSRC__SDL__FRAMEWORK.html">SDL API for Wearable Native</a></li>
+        </ul>
+    </div></div>
+</div>
+
+<div id="container"><div id="contents"><div class="content">
+
+<h1>Simple DirectMedia Layer (SDL)</h1>
+
+<p>You can access graphics hardware using Vulkan&reg; and OpenGL&reg; ES through the Simple DirectMedia Layer (SDL), a cross-platform software development library. SDL is used for creating high-performance computer games, multimedia applications, and emulators. It provides a low-level hardware abstraction layer to computer multimedia hardware components. It can run on many operating systems, such as Android&trade;, iOS, Linux, macOS, Windows&reg;, and Tizen. For more information, see the <a href="https://libsdl.org/" target="_blank">SDL Web site</a>.</p>
+
+<p>The main features of the SDL API include:</p>
+       <ul>
+               <li>Managing SDL applications
+               <p>You can manage the <a href="#lifecycle">SDL application life-cycle</a>.</p></li>
+               <li>Handling screen orientation
+               <p>You can <a href="#screen_orientation">set the supported screen orientations</a> for your SDL application.</p></li>
+               <li>Showing the status bar <strong>in mobile applications only</strong>
+               <p>You can <a href="#setting_indicator">manage the status bar</a> used to display icons or notifications.</p></li>
+       </ul>
+
+<p>SDL belongs to the hardware abstraction layer in Tizen. It allows managing video, audio, input devices, threads, and 3D graphics through graphics libraries, such as Vulkan&reg; and OpenGL&reg; ES. For information the comparative merits of Vulkan&reg; and OpenGL&reg;, see <a href="#vulkan_vs_opengles">Vulkan&reg; vs. OpenGL&reg;</a>. As shown in the following figure, SDL provides the application layer access to low-level 3D rendering API (Vulkan&reg; and OpenGL&reg; ES).</p>
+
+<p align="center"><strong>Figure: SDL in the Tizen framework</strong></p>
+<p align="center"><img alt="SDL in the Tizen framework" src="../../images/sdl_in_tizen.png" /></p>
+
+<p>The following SDL features are currently supported in Tizen:</p>
+<ul>
+       <li>SDL basic functions
+       <p>Use the <code>SDL.h</code>, <code>SDL_hints.h</code>, <code>SDL_error.h</code>, <code>SDL_log.h</code>, <code>SDL_assert.h</code>, <code>SDL_version.h</code>, <code>SDL_error.h</code>, and <code>SDL_stdinc.h</code> header files.</p></li>
+       <li>Display and window management
+       <p>Use the <code>SDL_video.h</code> and <code>SDL_syswm.h</code> header files.</p></li>
+       <li>Event handling
+       <p>Use the <code>SDL_events.h</code> and <code>SDL_keyboard.h</code> header files.</p></li>
+       <li>Audio device management
+       <p>Use the <code>SDL_audio.h</code> header file.</p></li>
+       <li>Thread and timer management
+       <p>Use the <code>SDL_thread.h</code>, <code>SDL_mutex.h</code>, <code>SDL_atomic.h</code>, and <code>SDL_timer.h</code> header files.</p></li>
+       <li>Platform and power information
+       <p>Use the <code>SDL_platform.h</code> and <code>SDL_power.h</code> header files.</p></li>
+</ul>
+
+<p>For the list of features not currently supported in Tizen, see the SDL API (in <a href="../../../../org.tizen.native.mobile.apireference/group__OPENSRC__SDL__FRAMEWORK.html">mobile</a> and <a href="../../../../org.tizen.native.wearable.apireference/group__OPENSRC__SDL__FRAMEWORK.html">wearable</a> applications). In Tizen, SDL supports the Vulkan and OpenGL&reg; ES graphics libraries only; the <code>SDL_render</code> library is not supported.</p>
+
+<div class="note">
+       <strong>Note</strong>
+       The following SDL header files related to the <code>SDL_render</code> library are not included in the Tizen native API:
+       <ul>
+               <li><code>SDL_render.h</code></li>
+               <li><code>SDL_pixels.h</code></li>
+               <li><code>SDL_rect.h</code></li>
+               <li><code>SDL_surface.h</code></li>
+       </ul>
+</div>
+
+
+<h2 id="vulkan_vs_opengles">Vulkan&reg; vs. OpenGL&reg;</h2>
+
+<p>When you consider the differences and advantages between Vulkan&reg; and OpenGL&reg;, Vulkan&reg; basically complements OpenGL&reg; by addressing specific users who want to have a quite low-level API with a much better abstraction of the modern hardware giving a lot of control, predictability, and high performance at much greater efficiency. On the other hand, OpenGL&reg; is a much higher-level API that does many things on your behalf inside the driver with less burden on you. It continues to be the API of choice for a wide range of developers who want to have the shortest path to a functionally correct application.</p>
+
+<p>When selecting the open graphics API (Vulkan&reg; or OpenGL&reg;) to use for a new application, or when considering the need to migrate an existing application from OpenGL&reg; to Vulkan&reg;, ask yourself the following questions:</p>
+<ul>
+<li>Do you want to have really low-level access and explicit control over the underlying GPU?</li>
+<li>Is your application/driver CPU-bound, too slow, and consuming too much power?</li>
+<li>Can your graphic work creation be parallelized and reused?</li>
+<li>Can you deal with additional code complexity to squeeze out maximum performance?</li>
+</ul>
+<p>If your answer to any of the questions is <strong>Yes</strong>, consider using Vulkan&reg; instead of OpenGL&reg;. However, remember that Vulkan&reg; comes at the cost of taking more responsibility at the application side from the driver.</p>
+
+<p>The following table describes the differences and advantages between Vulkan&reg; and OpenGL&reg;.</p>
+
+<p align="center" class="Table"><strong>Table: Comparison between Vulkan&reg; and OpenGL&reg;</strong></p>
+<table>
+<tbody>
+<tr>
+ <th></th>
+ <th>Vulkan&reg;</th>
+ <th>OpenGL&reg;</th>
+</tr>
+<tr>
+ <th>GPU control</th>
+ <td>Explicit API allows you to manage the state and resources as per specific application needs, and relieves you from hidden optimizations giving more control on the GPU.</td>
+ <td>Implicit driver manages the state and resources based on heuristics, leading to overhead and inefficiencies. The application has <strong>no control</strong>.</td>
+</tr>
+<tr>
+ <th>Multi-core friendliness</th>
+ <td>API is designed around asynchronous generation of command buffers across multiple threads and feeds them in sequence to a command pipeline, which reflects the realities of the modern hardware.</td>
+ <td>Originally designed for single-threaded architectures and does not allow the generation of graphic commands in parallel to command execution.</td>
+</tr>
+<tr>
+ <th>Efficiency</th>
+ <td>Vulkan&reg; greatly reduces the CPU time spent in the driver with external validation and diagnostics layers that can be independently enabled and disabled, as needed. Offloads the render thread by delegating heavy CPU jobs to the application and opt-in layers.</td>
+ <td>Does a lot of redundant excessive validation for each draw call, such as runtime error checking, implicit tracking of resource usage, and synchronization, leading to much CPU overhead.</td>
+</tr>
+<tr>
+ <th>Shader portability</th>
+ <td>Vulkan&reg; mandates the use of the intermediate byte code (SPIR-V) by the driver for shaders. This allows offline shader precompilation, and allows you to write shaders in languages other than GLSL.</td>
+ <td>Only GLSL is supported as a shader language, and the compiler is a part of the driver with vendor-specific semantics. No user control over the front end and higher runtime translation time.</td>
+</tr>
+<tr>
+ <th>Code complexity</th>
+ <td>Vulkan&reg; is a much more verbose API, offering more control at the cost of more code complexity and responsibility at the application side.</td>
+ <td>OpenGL&reg; driver manages many tasks inside the driver relieving you from the burden of managing these at the application end.</td>
+</tr>
+</tbody>
+</table>
+
+
+<h2 id="lifecycle">SDL Application Life-cycle in Tizen</h2>
+
+<p>The Tizen native application model is responsible for the application life-cycle and system events. The SDL application life-cycle is handled by the <code>SDL_PollEvent()</code> function, which manages the main event loop, the application state change events, and basic system events (<a href="#SDL_event">general</a> and <a href="#tizen_event">Tizen-specific</a>).</p>
+
+<p align="center"><strong>Figure: SDL application life-cycle</strong></p>
+<p align="center"><img alt="SDL application life-cycle" src="../../images/sdl_statemodel.png" /></p>
+
+<p>The SDL application can be in one of several different states, and the state changes are managed by the underlying framework.</p>
+
+<p align="center" class="Table"><strong>Table: SDL application states</strong></p>
+<table>
+<tbody>
+<tr>
+ <th>State</th>
+ <th>Description</th>
+</tr>
+<tr>
+ <td>READY</td>
+ <td>Application starts the main loop.</td>
+</tr>
+<tr>
+ <td>CREATED</td>
+ <td>Application is launched.</td>
+</tr>
+<tr>
+ <td>RUNNING</td>
+ <td>Application is running and visible to the user.</td>
+</tr>
+<tr>
+ <td>PAUSED</td>
+ <td>Application is running but invisible to the user.</td>
+</tr>
+<tr>
+ <td>TERMINATED</td>
+ <td>Application is terminated.</td>
+</tr>
+</tbody>
+</table>
+
+<p>Typically, the application is launched by the user from the Launcher, or by another application. The application is normally launched as the top window, with focus. When the application loses the focus status, the <code>SDL_APP_WILLENTERBACKGROUND</code> and <code>SDL_APP_DIDENTERBACKGROUND</code> events are invoked. The application can go into the pause state, which means that it is not terminated but continues to run in the background. The pause state can happen when:</p>
+<ul>
+<li>A new application is launched by the request of your application.</li>
+<li>The user requests to go to the home screen.</li>
+<li>A system event (such as an incoming phone call) occurs and causes a resident application with a higher priority to become active and temporarily hide your application.</li>
+<li>An alarm is triggered for another application, which becomes the topmost window and hides your application.</li>
+</ul>
+
+<p>When the application becomes visible again, the <code>SDL_APP_WILLENTERFOREGROUND</code> and <code>SDL_APP_DIDENTERFOREGROUND</code> events are invoked. The visibility returns, when:</p>
+<ul>
+<li>Another application requests your application to run (such as the Task Navigator, which shows all running applications and lets user select any application to run).</li>
+<li>All applications on top of your application in the window stack finish.</li>
+<li>An alarm is triggered for your application, bringing it to the front and hiding other applications.</li>
+</ul>
+
+<p>When the application starts exiting, the <code>SDL_QUIT</code> and <code>SDL_TERMINATING</code> events are invoked. Your application can start the termination process, when:</p>
+<ul>
+<li>The application itself requests to exit by calling the <code>ui_app_exit()</code> or <code>service_app_exit()</code> function to terminate the event loop.</li>
+<li>The low memory killer is terminating your application in a low memory situation.</li>
+</ul>
+
+<h2 id="prerequisites">Prerequisites</h2>
+
+<p>Before using graphics libraries in Tizen, make sure you understand the basic functions of <a href="https://www.khronos.org/opengles/" target="_blank">OpenGL&reg; ES</a> and <a href="https://www.khronos.org/vulkan" target="_blank">Vulkan&reg;</a>. For more information, see <a href="sdl_opengles_n.htm">SDL Graphics with OpenGL&reg; ES</a> and <a href="vulkan_n.htm">SDL Graphics with Vulkan&reg;</a>.</p>
+
+
+<h2 id="SDL_event">Handling General SDL Events</h2>
+
+<p>To handle general SDL events:</p>
+
+<ol>
+<li>Call the <code>SDL_PollEvent()</code> function, which polls the currently pending events and returns the <code>SDL_Event</code> instance. Before calling the <code>SDL_PollEvent()</code> function, create an empty <code>SDL_Event</code> structure.
+<pre class="prettyprint">
+void
+updateApp(appdata_s* ad)
+{
+    /* SDL_Event is a union containing structures for different event types */
+    SDL_Event event;
+    while (SDL_PollEvent(&amp;event)) {
+        SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL] Event type: %x\n", event.type);
+        handleEvent(&amp;ad, &amp;event);
+    }
+}
+</pre>
+</li>
+<li>The <code>SDL_PollEvent()</code> function removes the next event from the event queue. If there is no event in the queue, it returns 0. If there is an event, it fills the <code>SDL_Event</code> object with the event information.
+<p>The <code>SDL_Event</code> object is a union that contains structures for the different event types. The <code>type</code> member specifies the event type, shared with all events. The <code>type</code> member is related to the <a href="https://wiki.libsdl.org/SDL_EventType" target="blank">SDL_EventType</a> enumeration.</p>
+<p>To handle each event type separately, use a switch statement:</p>
+
+<pre class="prettyprint">
+void
+handleEvent(appdata_s** data, SDL_Event* event)
+{
+    appdata_s* ad = *data;
+
+    switch (event-&gt;type) {
+    case SDL_QUIT:
+        SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL] Finish main loop ");
+        ad-&gt;game_exit = 1;
+        break;
+    case SDL_KEYUP:
+        char* scancodename = (char *)SDL_GetScancodeName(event-&gt;key.keysym.scancode);
+        SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL] keyboard scancode: %s", scancodename);
+        if (event-&gt;key.keysym.scancode == SDL_SCANCODE_AC_BACK) {
+            SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL] Finish main loop ");
+            ad-&gt;game_exit = 1;
+        }
+        break;
+    case SDL_MOUSEBUTTONDOWN:
+        SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL]Mouse Down: %d x %d", event-&gt;button.x, event-&gt;button.y);
+        break;
+    case SDL_MOUSEBUTTONUP:
+        SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL]Mouse Up: %d x %d", event-&gt;button.x, event-&gt;button.y);
+        break;
+    case SDL_MOUSEMOTION:
+        SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL]Mouse Motion: %d x %d", event-&gt;motion.x, event-&gt;motion.y);
+        break;
+    case SDL_ROTATEEVENT:
+        ad-&gt;window_rotation = (int)event-&gt;user.data1;
+        SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL] Rotation degree: %d", ad-&gt;window_rotation);
+        break;
+    case SDL_WINDOWEVENT:
+        SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "SDL_WINDOWEVENT Event!!");
+        if (event-&gt;window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
+            SDL_Log("SDL_WINDOWEVENT_SIZE_CHANGED!!!");
+        break;
+    } /* End switch */
+}
+</pre>
+</li>
+</ol>
+
+<h2 id="tizen_event">Handling Tizen-specific SDL Events</h2>
+
+<p>To handle SDL events specifically added to the Tizen application framework:</p>
+
+<ul>
+<li><code>SDL_APP_CONTROL</code>
+<p>This event is invoked when the application is launched with some parameters.</p>
+
+<p>The application framework calls the application's control callback just after the application enters the main loop. This callback is passed to the <code>app_control</code> instance containing the reason why the application was launched. For example, the application can be launched to open a file to handle the request that has been sent by another application. In any case, the application is responsible for checking the <code>app_control</code> content and responding appropriately. The <code>app_control</code> content can be empty, if the application is launched from the launcher.</p>
+<p>In SDL, <code>SDL_APP_CONTROL</code> has been defined as a new <code>SDL_Event</code> event type for the application control. After the application enters the main loop, SDL sends the <code>SDL_APP_CONTROL</code> event to the application. This means that the application can confirm the <code>SDL_Event</code> in the event loop. The event is defined as an <code>SDL_UserEvent</code>, which is in the <code>user</code> member of the <code>SDL_Event</code> union.</p>
+
+<p>The <code>user</code> structure contains <code>data1</code> (<code>app_control</code>) and <code>data2</code> (<code>user_data</code>).</p>
+
+<p>In Tizen, you must include the <code>&lt;app.h&gt;</code> header file to use the application control. For more information, see the <a href="../app_management/app_controls_n.htm">Application Controls</a> guide.</p>
+<pre class="prettyprint">
+#include &lt;app.h&gt;
+
+case SDL_APP_CONTROL:
+    app_control_h app_control = event.user.data1;
+    void *user_data = event.user.data2;
+
+    char *operation;
+    char *uri;
+
+    app_control_get_operation(app_control, &amp;operation);
+    if (!strcmp(operation, APP_CONTROL_OPERATION_VIEW)) {
+        app_control_get_uri(app_control, &amp;uri);
+        app_control_get_extra_data(app_control, "action", &amp;action);
+        SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Get path: [%s], action: [%s]", uri, action);
+    }
+    break;
+</pre>
+</li>
+<li><code>SDL_APP_LOWBATTERY</code>
+<p>This event is invoked when the application is low on battery. Use it to reduce power consumption, if possible. In Tizen, this event is called in the <code>_tizen_app_low_battery()</code> function.</p>
+<p>Get the low battery status from the given event info by calling the <code>app_event_get_low_battery_status()</code> function. The <code>app_event_low_battery_status_e</code> (in <a href="../../../../org.tizen.native.mobile.apireference/group__CAPI__APP__COMMON__MODULE.html#gacd053e5be8bdd4a4e3cc5bb20916af00">mobile</a> and <a href="../../../../org.tizen.native.wearable.apireference/group__CAPI__APP__COMMON__MODULE.html#gacd053e5be8bdd4a4e3cc5bb20916af00">wearable</a> applications) is the enumeration for the battery status: <code>APP_EVENT_LOW_BATTERY_POWER_OFF</code> means that the battery charge is under 1% and <code>APP_EVENT_LOW_BATTERY_CRITICAL_LOW</code> under 5%.</p>
+
+<pre class="prettyprint">
+#include &lt;app.h&gt;
+
+case SDL_APP_LOWBATTERY:
+    SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL] SDL_APP_LOWBATTERY ");
+
+    app_event_info_h event_info = event-&gt;user.data1;
+    void *user_data = event-&gt;user.data2;
+
+    app_event_low_battery_status_e status;
+    int ret = app_event_get_low_battery_status(event_info, &amp;status);
+    if (ret == APP_ERROR_NONE) {
+        if (status == APP_EVENT_LOW_BATTERY_POWER_OFF)
+            SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL] The battery status is under 1% ");
+        else if (status == APP_EVENT_LOW_BATTERY_CRITICAL_LOW)
+            SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL] The battery status is under 5% ");
+    }
+    break;
+</pre>
+</li>
+<li><code>SDL_APP_LANGUAGE_CHANGED</code> and <code>SDL_APP_REGION_FORMAT_CHANGED</code>
+<p>These events are invoked when the displayed language and region are changed by the system.</p>
+<p>The <code>user</code> structure contains <code>data1</code> (language or region data).</p>
+<pre class="prettyprint">
+/* Displayed language is changed by system */
+case SDL_APP_LANGUAGE_CHANGED:
+    SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL] SDL_APP_LANGUAGE_CHANGED: %s", (char*)event->user.data1);
+    break;
+/* Displayed region is changed by system */
+case SDL_APP_REGION_CHANGED:
+    SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL] SDL_APP_REGION_CHANGED: %s", (char*)event->user.data1);
+    break;
+</pre>
+</li>
+</ul>
+
+<h2 id="screen_orientation">Handling Screen Orientation</h2>
+<p>Tizen supports portrait and landscape screen orientations. You must take care of how your application responds to screen orientation changes.</p>
+<p>To set the supported screen orientations for the application, use the <code>SDL_SetHint()</code> function with the first parameter set to <code>SDL_HINT_ORIENTATIONS</code>, and the second parameter listing the supported screen orientations as a string.</p>
+
+<pre class="prettyprint">
+SDL_SetHint(SDL_HINT_ORIENTATIONS, "Portrait LandscapeLeft LandscapeRight");
+</pre>
+
+<p>The following table lists the screen orientations supported in SDL.</p>
+
+<p align="center" class="Table"><strong>Table: Screen orientations in SDL</strong></p>
+<table>
+<tbody>
+<tr>
+ <th>Orientation</th>
+ <th>Description</th>
+</tr>
+<tr>
+ <td><code>LandscapeLeft</code></td>
+ <td>Landscape, with the top of the device facing left.</td>
+</tr>
+<tr>
+ <td><code>LandscapeRight</code></td>
+ <td>Landscape, with the top of the device facing right.</td>
+</tr>
+<tr>
+ <td><code>Portrait</code></td>
+ <td>Portrait, with the top of the device facing up.</td>
+</tr>
+</tbody>
+</table>
+
+<h2 id="setting_indicator">Showing the Status Bar in Mobile Applications</h2>
+
+<p>Mobile devices have a status bar  at the top of the screen. The status bar can contain icons for battery status or reception, or various notifications. Pulling the status bar down reveals the notification panel, which can display, for example, current downloads, new messages, or missed calls.</p>
+<p>Since Tizen 4.0, you can manage the status bar appearance in SDL applications:</p>
+<ul>
+       <li>To show the status bar, use the <code>SDL_SetWindowBordered()</code> function with the second parameter set to <code>SDL_TRUE</code>:
+
+<pre class="prettyprint">
+SDL_SetWindowBordered(window, SDL_TRUE);
+</pre>
+       </li>
+       <li>To set the opacity of the status bar, use the <code>SDL_SetHint()</code> function, with the first parameter set to <code>SDL_HINT_TIZEN_INDICATOR_OPACITY</code> and the second parameter containing the desired opacity value as a string:
+
+<pre class="prettyprint">
+SDL_SetHint(SDL_HINT_TIZEN_INDICATOR_OPACITY, "opaque");
+</pre>
+
+<p>The following table lists the available status bar opacity values.</p>
+
+<p align="center" class="Table"><strong>Table: Status bar opacity values</strong></p>
+<table>
+<tbody>
+<tr>
+ <th>Opacity value</th>
+ <th>Description</th>
+</tr>
+<tr>
+ <td><code>opaque</code></td>
+ <td>Makes the status bar opaque.</td>
+</tr>
+<tr>
+ <td><code>translucent</code></td>
+ <td>Makes the status bar translucent.</td>
+</tr>
+<tr>
+ <td><code>transparent</code></td>
+ <td>Makes the status bar transparent. This is the default value.</td>
+</tr>
+<tr>
+ <td><code>bg_transparent</code></td>
+ <td>Makes the status bar background transparent.</td>
+</tr>
+</tbody>
+</table>
+       </li>
+</ul>
+
+<script type="text/javascript" src="../../scripts/jquery.zclip.min.js"></script>
+<script type="text/javascript" src="../../scripts/showhide.js"></script>
+</div></div></div>
+
+<a class="top sms" href="#"><img src="../../images/btn_top.gif" alt="Go to top" /></a>
+
+<div id="footer">
+<p class="footer">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br/>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</p>
+</div>
+
+<script type="text/javascript">
+var _gaq = _gaq || [];
+_gaq.push(['_setAccount', 'UA-25976949-1']);
+_gaq.push(['_trackPageview']);
+(function() {
+var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+})();
+</script>
+
+</body>
+</html>
diff --git a/org.tizen.guides/html/native/graphics/sdl_opengles_n.htm b/org.tizen.guides/html/native/graphics/sdl_opengles_n.htm
new file mode 100644 (file)
index 0000000..800b8b9
--- /dev/null
@@ -0,0 +1,397 @@
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+    <meta http-equiv="X-UA-Compatible" content="IE=9" />
+    <link rel="stylesheet" type="text/css" href="../../css/styles.css" />
+    <link rel="stylesheet" type="text/css" href="../../css/snippet.css" />
+    <script type="text/javascript" src="../../scripts/snippet.js"></script>
+    <script type="text/javascript" src="../../scripts/jquery.util.js" charset="utf-8"></script>
+    <script type="text/javascript" src="../../scripts/common.js" charset="utf-8"></script>
+    <script type="text/javascript" src="../../scripts/core.js" charset="utf-8"></script>
+    <script type="text/javascript" src="../../scripts/search.js" charset="utf-8"></script>
+  <title>SDL Graphics with OpenGL&reg; ES</title>
+ </head>
+ <body onload="prettyPrint()" style="overflow: auto;">
+
+ <div id="toc-navigation">
+    <div id="profile">
+        <p><img alt="Mobile native" src="../../images/mobile_s_n.png"/> <img alt="Wearable native" src="../../images/wearable_s_n.png"/></p>
+    </div>
+
+       <div id="toc_border"><div id="toc">
+               <p class="toc-title">Dependencies</p>
+               <ul class="toc">
+                       <li>Tizen 4.0 and Higher for Mobile</li>
+                       <li>Tizen 4.0 and Higher for Wearable</li>
+               </ul>
+        <p class="toc-title">Content</p>
+        <ul class="toc">
+                       <li><a href="#prerequisites">Prerequisites</a></li>
+            <li><a href="#render">Rendering a Cube with OpenGL&reg; ES</a></li>
+            <li><a href="#attributes">OpenGL&reg; Context Attributes</a></li>
+               </ul>
+        <p class="toc-title">Related Info</p>
+        <ul class="toc">
+                       <li><a href="vulkan_n.htm">SDL Graphics with Vulkan&reg;</a></li>
+                       <li><a href="../../../../org.tizen.native.mobile.apireference/group__OPENSRC__OPENGLES__FRAMEWORK.html">OpenGL ES API for Mobile Native</a></li>
+                       <li><a href="../../../../org.tizen.native.wearable.apireference/group__OPENSRC__OPENGLES__FRAMEWORK.html">OpenGL ES API for Wearable Native</a></li>
+        </ul>
+    </div></div>
+</div>
+
+<div id="container"><div id="contents"><div class="content">
+
+<h1>SDL Graphics with OpenGL&reg; ES</h1>
+<p>OpenGL&reg;  ES is a standard specification defining a cross-language, cross-platform API for writing applications that produce 2D and 3D computer graphics.
+Tizen supports OpenGL&reg;  ES versions 1.1, 2.0, 3.0, 3.1, and 3.2. For general information on OpenGL&reg;ES, and the comparative merits of Vulkan&reg; and OpenGL&reg;, see the official Khronos <a href="https://www.khronos.org/opengles/" target="_blank">OpenGL&reg; ES Web site</a> and <a href="sdl_n.htm#vulkan_vs_opengles">Vulkan&reg; vs. OpenGL&reg;</a>.</p>
+
+<p align="center"><strong>Figure: OpenGL&reg; ES in Tizen</strong></p>
+<p align="center"><img alt="opengles in Tizen" src="../../images/sdl_opengles.png" /></p>
+
+<p>The main OpenGL ES API features include <a href="#render">rendering 3D objects in an SDL application</a>.</p>
+
+<h2 id="prerequisites">Prerequisites</h2>
+
+<p>To enable your application to use the OpenGL&reg; ES functionality:</p>
+
+<ol>
+       <li>To use OpenGL&reg; ES for 3D rendering, you must create an SDL application, and understand both <a href="https://www.khronos.org/opengles/" target="blank">OpenGL&reg; ES</a> and <a href="https://www.libsdl.org/" target="blank">SDL</a>.</li>
+       <li>Check whether the device supports a specific version of OpenGL&reg;  ES.
+       <p>Check for device support using the <code>system_info_get_platform_bool()</code> function, before using the OpenGL ES APIs. If the device can support the specific OpenGL&reg; ES version, the function returns <code>true</code> in the second parameter.</p>
+<pre class="prettyprint">
+bool opengles_support;
+/* Check support for the OpenGL&reg; ES 2.0 version */
+system_info_get_platform_bool("http://tizen.org/feature/opengles.version.2_0", &amp;opengles_support);
+</pre>
+       </li>
+       <li>To use the functions and data types of the OpenGL ES (in <a href="../../../../org.tizen.native.mobile.apireference/group__OPENSRC__OPENGLES__FRAMEWORK.html">mobile</a> and <a href="../../../../org.tizen.native.wearable.apireference/group__OPENSRC__OPENGLES__FRAMEWORK.html">wearable</a> applications) and SDL (in <a href="../../../../org.tizen.native.mobile.apireference/group__OPENSRC__SDL__FRAMEWORK.html">mobile</a> and <a href="../../../../org.tizen.native.wearable.apireference/group__OPENSRC__SDL__FRAMEWORK.html">wearable</a> applications) APIs, include the <code>&lt;SDL.h&gt;</code> header file and the appropriate OpenGL&reg; ES version header file in your application:
+<pre class="prettyprint">
+#include &lt;SDL.h&gt;
+/* Header file for the OpenGL&reg; ES 2.0 version */
+#include &lt;GLES2/GLES2.h&gt;
+</pre>
+</li>
+</ol>
+<p align="center" class="Table"><strong>Table: OpenGL® ES feature keys and header files</strong></p>
+<table>
+<tbody>
+<tr>
+ <th>Version</th>
+ <th>Feature key</th>
+ <th>Header file</th>
+</tr>
+<tr>
+ <td>OpenGL&reg; ES 1.1</td>
+ <td><code>http://tizen.org/feature/opengles.version.1_1</code></td>
+ <td><code>&lt;GLES/GLES.h&gt;</code> or <code>&lt;SDL_opengles.h&gt;</code></td>
+</tr>
+<tr>
+ <td>OpenGL&reg; ES 2.0</td>
+ <td><code>http://tizen.org/feature/opengles.version.2_0</code></td>
+ <td><code>&lt;GLES2/GLES2.h&gt;</code> or <code>&lt;SDL_opengles2.h&gt;</code></td>
+</tr>
+<tr>
+ <td>OpenGL&reg; ES 3.0</td>
+ <td><code>http://tizen.org/feature/opengles.version.3_0</code></td>
+ <td rowspan="3"><code>&lt;GLES3/GLES3.h&gt;</code></td>
+ </tr>
+<tr>
+ <td>OpenGL&reg; ES 3.1</td>
+ <td><code>http://tizen.org/feature/opengles.version.3_1</code></td>
+</tr>
+<tr>
+ <td>OpenGL&reg; ES 3.2</td>
+ <td><code>http://tizen.org/feature/opengles.version.3_2</code></td>
+</tr>
+</tbody>
+</table>
+
+<h2 id="render">Rendering a Cube with OpenGL&reg; ES</h2>
+
+<p>To render a cube using OpenGL&reg; ES  in an SDL application:</p>
+
+<ol>
+<li>Initialize the SDL library and create the SDL window.
+
+<p>Before using any other SDL functions, call the <code>SDL_Init()</code> function to properly initialize the SDL library and start each of its various subsystems. The function accepts as a parameter a set of allowed flags combined using the "|" pipe operation.</p>
+<p>After SDL is initialized successfully, create the <code>SDL_Window</code> instance using the <code>SDL_CreateWindow()</code> function. The parameters define the title of the window, the X and Y position coordinates, width, height, and a set of <code>SDL_WindowFlags</code> combined using the "|" pipe operation.</p>
+
+<div class="note">
+       <strong>Note</strong>
+       To use the OpenGL&reg; ES context, use the <code>SDL_WINDOW_OPENGL</code> flag when you create a window. Do not use both <code>SDL_WINDOW_VULKAN</code> and <code>SDL_WINDOW_OPENGL</code> simultaneously.
+</div>
+
+<p>The <code>SDL_main()</code> function is mandatory for the Tizen framework to initialize the SDL application. You must use the <code>SDL_main()</code> function instead of the usual <code>main()</code> function in your SDL application.</p>
+
+<pre class="prettyprint">
+int
+SDL_main(int argc, char *argv[])
+{
+    SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS);
+    demo.sdl_window = SDL_CreateWindow("SDL OpenGL ES Sample", 0, 0, demo.sdl_mode.w, demo.sdl_mode.h,
+                                       SDL_WINDOW_SHOWN | SDL_WINDOW_FULLSCREEN | SDL_WINDOW_OPENGL);
+}
+</pre>
+</li>
+<li>Initialize the OpenGL&reg; ES context:
+    <ol type="a">
+        <li>Set the context properties using the <a href="#attributes">available attributes</a>:
+
+<pre class="prettyprint">
+int
+initGL(appdata_s* ad)
+{
+    SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
+    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
+    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
+    SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
+    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
+    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
+</pre>
+</li>
+<li>Create the context:
+<pre class="prettyprint">
+    /* Create context for OpenGL&reg; window */
+    ad-&gt;gl = SDL_GL_CreateContext(ad-&gt;window);
+    if (ad-&gt;gl == NULL) {
+        SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL] GL context creation failed!");
+
+        return (-1);
+    }
+
+    /* Set context as current */
+    SDL_GL_MakeCurrent(ad-&gt;window, ad-&gt;gl);
+
+    return (0);
+}
+</pre></li>
+</ol></li>
+<li>Initialize the shaders, identity matrix, and buffer.
+<p>Shaders are created and compiled in the <code>init_shaders()</code> function, and attached to the <code>glProgram</code> object.</p>
+<p>The <code>generateAndBindBuffer()</code> function creates a vertex buffer object, which is managed using the <code>glGenBuffers()</code>, <code>glBindBuffer()</code>, and <code>glBufferData()</code> functions.</p>
+
+<pre class="prettyprint">
+/* Initialize shaders */
+init_shaders(&amp;ad);
+
+/* Initialize matrix for camera view */
+init_matrix(ad.view);
+
+/* Generate and bind vertex buffer object */
+generateAndBindBuffer(&amp;(ad.vbo));
+</pre>
+</li>
+<li>Calculate the view aspect ratio and apply an orthographic matrix.
+<p>The aspect ratio determines the field of view in the X direction, and is the ratio of X (width) to Y (height).</p>
+<pre class="prettyprint">
+float aspect = (ad.mode.w &gt; ad.mode.h ? (float)ad.mode.w / ad.mode.h : (float)ad.mode.h / ad.mode.w);
+if (ad.mode.w &gt; ad.mode.h)
+    view_set_ortho(ad.view, -1.0 * aspect, 1.0 * aspect, -1.0, 1.0, -1.0, 100.0);
+else
+    view_set_ortho(ad.view, -1.0, 1.0, -1.0 * aspect, 1.0 * aspect, -1.0, 100.0);
+</pre>
+</li>
+<li>To draw the scene:
+<ol type="a">
+<li>Clear the buffer.
+<p>The <code>glClear()</code> function clears buffers to preset values. The function accepts as a parameter a set of allowed flags, indicating the buffers to be cleared, combined using the "|" pipe operation. The available flags are <code>GL_COLOR_BUFFER_BIT</code>, <code>GL_DEPTH_BUFFER_BIT</code>, <code>GL_ACCUM_BUFFER_BIT</code>, and <code>GL_STENCIL_BUFFER_BIT</code>.</p>
+<p>The <code>glClearColor()</code> function specifies the <code>red</code>, <code>green</code>, <code>blue</code>, and <code>alpha</code> values used when the color buffers are cleared.</p>
+
+<pre class="prettyprint">
+void
+drawScene(appdata_s* ad)
+{
+    glViewport(0, 0, ad-&gt;w, ad-&gt;h);
+    glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
+    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+</pre></li>
+<li>Render the scene:
+<pre class="prettyprint">
+    init_matrix(ad-&gt;model);
+    rotate_xyz(ad-&gt;model, ad-&gt;anglePoint.x, ad-&gt;anglePoint.y, ad-&gt;window_rotation);
+
+    multiply_matrix(ad-&gt;mvp, ad-&gt;view, ad-&gt;model);
+    glUseProgram(ad-&gt;program);
+
+    glBindBuffer(GL_ARRAY_BUFFER, ad-&gt;vbo);
+    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(float) * 6, 0);
+    glEnableVertexAttribArray(0);
+
+    glBindBuffer(GL_ARRAY_BUFFER, ad-&gt;vbo);
+    glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(float) * 6, (void*)(sizeof(float) * 3));
+    glEnableVertexAttribArray(1);
+
+    glUniformMatrix4fv(glGetUniformLocation(ad-&gt;program, "mvpMatrix"), 1, GL_FALSE, ad-&gt;mvp);
+
+    /* Render primitives from array data*/
+    glDrawArrays(GL_TRIANGLES, 0, 36);
+    </pre>
+</li>
+<li>Update the OpenGL&reg; rendering window:
+<pre class="prettyprint">
+    SDL_GL_SwapWindow(ad-&gt;window);
+}
+</pre></li></ol>
+</li>
+
+
+<li>Quit SDL.
+<p>Before exiting the application, destroy the SDL objects:</p>
+<pre class="prettyprint">
+SDL_Quit();
+</pre>
+</li>
+</ol>
+<h2 id="attributes">OpenGL&reg; Context Attributes</h2>
+<p>The following table lists the attributes whose values can be set using the <code>SDL_GL_SetAttribute()</code> function.</p>
+<p align="center" class="Table"><strong>Table: OpenGL&reg; context attributes</strong></p>
+<table>
+<tbody>
+<tr>
+<th>Attribute</th>
+<th>Description</th>
+<th>Default value</th>
+</tr>
+
+<tr>
+ <td><code>SDL_GL_ACCELERATED_VISUAL</code></td>
+ <td>Set to 1 to require hardware acceleration; set to 0 to force software rendering
+<p>In Tizen, hardware acceleration is used regardless of the value set to this attribute.</p></td>
+ <td>-</td>
+</tr>
+<tr>
+ <td><code>SDL_GL_ACCUM_ALPHA_SIZE</code></td>
+ <td>Minimum number of bits for the accumulation buffer alpha channel</td>
+ <td rowspan="3">0</td>
+</tr>
+<tr>
+ <td><code>SDL_GL_ACCUM_BLUE_SIZE</code></td>
+ <td>Minimum number of bits for the accumulation buffer blue channel</td>
+</tr>
+<tr>
+ <td><code>SDL_GL_ACCUM_GREEN_SIZE</code></td>
+ <td>Minimum number of bits for the accumulation buffer green channel</td>
+</tr>
+<tr>
+ <td><code>SDL_GL_ACCUM_RED_SIZE</code></td>
+ <td>Minimum number of bits for the accumulation buffer red channel</td>
+ <td>3</td>
+</tr>
+<tr>
+ <td><code>SDL_GL_ALPHA_SIZE</code></td>
+ <td>Minimum number of bits for the color buffer alpha channel</td>
+ <td>0</td>
+</tr>
+<tr>
+ <td><code>SDL_GL_BLUE_SIZE</code></td>
+ <td>Minimum number of bits for the color buffer blue channel</td>
+ <td>2</td>
+</tr>
+<tr>
+ <td><code>SDL_GL_BUFFER_SIZE</code></td>
+ <td>Minimum number of bits for the frame buffer</td>
+ <td rowspan="2">0</td>
+</tr>
+<tr>
+ <td><code>SDL_GL_CONTEXT_FLAGS</code></td>
+ <td>Combination of 0 or more elements of the <code>SDL_GLcontextFlag</code> enumeration</td>
+ </tr>
+<tr>
+ <td><code>SDL_GL_CONTEXT_MAJOR_VERSION</code></td>
+ <td>OpenGL&reg; context major version</td>
+ <td rowspan="3">-</td>
+</tr>
+<tr>
+ <td><code>SDL_GL_CONTEXT_MINOR_VERSION</code></td>
+ <td>OpenGL&reg; context minor version</td>
+</tr>
+<tr>
+ <td><code>SDL_GL_CONTEXT_PRIORITY</code></td>
+ <td>Allow a GL context to be created with a priority hint</td>
+</tr>
+<tr>
+ <td><code>SDL_GL_CONTEXT_PROFILE_MASK</code></td>
+ <td>Type of GL context (Core, Compatibility, ES)</td>
+ <td>Depends on the platform</td>
+</tr>
+<tr>
+ <td><code>SDL_GL_CONTEXT_RELEASE_BEHAVIOR</code></td>
+ <td>Set the context release behavior (since SDL 2.0.4)</td>
+ <td>1</td>
+</tr>
+<tr>
+ <td><code>SDL_GL_DEPTH_SIZE</code></td>
+ <td>Minimum number of bits for the depth buffer</td>
+ <td>16</td>
+</tr>
+<tr>
+ <td><code>SDL_GL_DOUBLEBUFFER</code></td>
+ <td>Whether the output is double-buffered</td>
+ <td>1 (Double-buffered)</td>
+</tr>
+<tr>
+ <td><code>SDL_GL_FRAMEBUFFER_SRGB_CAPABLE</code></td>
+ <td>Request sRGB-capable visuals (since SDL 2.0.1)</td>
+ <td>0</td>
+</tr>
+<tr>
+ <td><code>SDL_GL_GREEN_SIZE</code></td>
+ <td>Minimum number of bits for the color buffer green channel</td>
+ <td>3</td>
+</tr>
+<tr>
+ <td><code>SDL_GL_MULTISAMPLEBUFFERS</code></td>
+ <td>Number of buffers used for multisample anti-aliasing</td>
+ <td rowspan="2">0</td>
+</tr>
+<tr>
+ <td><code>SDL_GL_MULTISAMPLESAMPLES</code></td>
+ <td>Number of samples around the current pixel used for multisample anti-aliasing</td>
+</tr>
+<tr>
+ <td><code>SDL_GL_RED_SIZE</code></td>
+ <td>Minimum number of bits for the color buffer red channel</td>
+ <td>3</td>
+</tr>
+<tr>
+ <td><code>SDL_GL_SHARE_WITH_CURRENT_CONTEXT</code></td>
+ <td>Whether OpenGL&reg; context sharing is enabled</td>
+ <td rowspan="2">0</td>
+</tr>
+<tr>
+ <td><code>SDL_GL_STENCIL_SIZE</code></td>
+ <td>Minimum number of bits for the stencil buffer</td>
+</tr>
+<tr>
+ <td><code>SDL_GL_STEREO</code></td>
+ <td>Whether stereo 3D output is enabled</td>
+ <td><code>off</code></td>
+</tr>
+</tbody>
+</table>
+
+<script type="text/javascript" src="../../scripts/jquery.zclip.min.js"></script>
+<script type="text/javascript" src="../../scripts/showhide.js"></script>
+</div></div></div>
+
+<a class="top sms" href="#"><img src="../../images/btn_top.gif" alt="Go to top" /></a>
+
+<div id="footer">
+<p class="footer">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br/>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</p>
+</div>
+
+<script type="text/javascript">
+var _gaq = _gaq || [];
+_gaq.push(['_setAccount', 'UA-25976949-1']);
+_gaq.push(['_trackPageview']);
+(function() {
+var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+})();
+</script>
+
+</body>
+</html>
index f521681..3a5d2bd 100644 (file)
                </ul>
         <p class="toc-title">Content</p>
         <ul class="toc">
-                       <li><a href="#vulkan_1">OpenGL&reg; vs. Vulkan&reg;</a></li>
-                       <li><a href="#sdl">SDL</a></li>
                        <li><a href="#prerequisites">Prerequisites</a></li>
             <li><a href="#render">Rendering a Triangle with Vulkan&reg;</a></li>
-                       <li><a href="#SDL_event">Handling General SDL Events</a></li>
-                       <li><a href="#tizen_event">Handling Tizen-specific SDL Events</a></li>
                </ul>
         <p class="toc-title">Related Info</p>
         <ul class="toc">
+                       <li><a href="sdl_opengles_n.htm">SDL Graphics with OpenGL&reg; ES</a></li>
                        <li><a href="../../../../org.tizen.native.mobile.apireference/group__OPENSRC__VULKAN__FRAMEWORK.html">Vulkan API for Mobile Native</a></li>
                        <li><a href="../../../../org.tizen.native.wearable.apireference/group__OPENSRC__VULKAN__FRAMEWORK.html">Vulkan API for Wearable Native</a></li>
         </ul>
 
 <h1>SDL Graphics with Vulkan&reg;</h1>
 
-<p>Vulkan&reg; is a generation API for high-efficiency access to graphics and computing on modern GPUs. It is an open-standard, cross-platform API designed from the ground up by industry experts collaborating under the Khronos consortium. It aims to address the inefficiencies of existing 3D APIs, such as OpenGL&reg;, which are designed for single-core processors and lag to map modern hardware. It provides a much lower-level fine-grained control over the GPU to maximize performance and achieve a consistent user experience across different operating environments. For general information on Vulkan&reg;, and the comparative merits of Vulkan&reg; and OpenGL&reg;, see the official Khronos <a href="https://www.khronos.org/vulkan/" target="_blank">Vulkan&reg; Web site</a> and <a href="#vulkan_1">OpenGL&reg; vs. Vulkan&reg;</a>.</p>
-<p>The Tizen platform supports the Vulkan API in order to provide the most cutting-edge 3D programming tools for you to create high-quality games and real-time graphics in applications. Vulkan&reg; is especially recommended for performance- or latency-sensitive applications. With Vulkan&reg;, you can achieve a much smoother user experience by parallelizing the rendering job across multiple threads which can feed the GPU in an efficient manner. Applications demanding explicit control on work submission, synchronization, and less power consumption can seriously consider migrating to Vulkan&reg; as well. Tizen allows the <a href="#render">use of the Vulkan API</a> through <a href="#sdl">SDL</a>.</p>
+<p>Vulkan&reg; is a generation API for high-efficiency access to graphics and computing on modern GPUs. It is an open-standard, cross-platform API designed from the ground up by industry experts collaborating under the Khronos consortium. It aims to address the inefficiencies of existing 3D APIs, such as OpenGL&reg;, which are designed for single-core processors and lag to map modern hardware. It provides a much lower-level fine-grained control over the GPU to maximize performance and achieve a consistent user experience across different operating environments. For general information on Vulkan&reg;, and the comparative merits of Vulkan&reg; and OpenGL&reg;, see the official Khronos <a href="https://www.khronos.org/vulkan/" target="_blank">Vulkan&reg; Web site</a> and <a href="sdl_n.htm#vulkan_vs_opengles">Vulkan&reg; vs. OpenGL&reg;</a>.</p>
+<p>The Tizen platform supports the Vulkan API in order to provide the most cutting-edge 3D programming tools for you to create high-quality games and real-time graphics in applications. Vulkan&reg; is especially recommended for performance- or latency-sensitive applications. With Vulkan&reg;, you can achieve a much smoother user experience by parallelizing the rendering job across multiple threads which can feed the GPU in an efficient manner. Applications demanding explicit control on work submission, synchronization, and less power consumption can seriously consider migrating to Vulkan&reg; as well. Tizen allows the use of the Vulkan API through <a href="https://libsdl.org/" target="_blank">SDL</a>.</p>
 
 <p align="center"><strong>Figure: Vulkan&reg; in Tizen</strong></p>
 <p align="center"><img alt="Vulkan in Tizen" src="../../images/vulkan_framework.png" /></p>
 
+<p>The main Vulkan API features include <a href="#render">rendering 3D objects in an SDL application</a>.</p>
+
 <p>Before using the Vulkan API in Tizen, make sure that you are familiar with the following key Vulkan&reg; features, which help you to align your application design around Vulkan&reg; concepts and exploit the hardware to the fullest:</p>
 
 <ul>
 <p>With the introduction of an intermediate shader language, called SPIR-V, Vulkan&reg; improves the shader program portability and allows you to write shaders in languages other than GLSL (such as C/C++). This avoids the need for the compiler to execute during runtime to translate the shader code and allows offline shader precompilation. It also relieves the vendors from the shader/kernel source shipping and IP leakage.</p></li>
 </ul>
 
-<h2 id="vulkan_1">OpenGL&reg; vs. Vulkan&reg;</h2>
-
-<p>When you consider the differences and advantages between Vulkan&reg; and OpenGL&reg;, Vulkan&reg; basically complements OpenGL&reg; by addressing specific users who want to have a quite low-level API with a much better abstraction of the modern hardware giving a lot of control, predictability, and high performance at much greater efficiency. On the other hand, OpenGL&reg; is a much higher-level API that does many things on your behalf inside the driver with less burden on you. It continues to be the API of choice for a wide range of developers who want to have the shortest path to a functionally correct application.</p>
-
-<p>When selecting the open graphics API (Vulkan&reg; or OpenGL&reg;) to use for a new application, or when considering the need to migrate an existing application from OpenGL&reg; to Vulkan&reg;, ask yourself the following questions:</p>
-<ul>
-<li>Do you want to have really low-level access and explicit control over the underlying GPU?</li>
-<li>Is your application/driver CPU-bound, too slow and consuming too much power?</li>
-<li>Can your graphic work creation be parallelized and reused?</li>
-<li>Can you deal with additional code complexity to squeeze out maximum performance?</li>
-</ul>
-<p>If your answer to any of the questions is <strong>Yes</strong>, consider using Vulkan&reg; instead of OpenGL&reg;. However, remember that Vulkan&reg; comes at the cost of taking more responsibility at the application side from the driver.</p>
-
-<p>The following table describes the practical advantages of Vulkan&reg;.</p>
-
-<p align="center" class="Table"><strong>Table: Vulkan&reg; advantages</strong></p>
-<table>
-<tbody>
-<tr>
- <th></th>
- <th>OpenGL&reg;</th>
- <th>Vulkan&reg;</th>
-</tr>
-<tr>
- <th>Better GPU control</th>
- <td>Implicit driver manages the state and resources based on heuristics, leading to overhead and inefficiencies. The application has <strong>no control</strong>.</td>
- <td>Explicit API allows you to manage the state and resources as per specific application needs, and relieves you from hidden optimizations giving more control on the GPU.</td>
-</tr>
-<tr>
- <th>Multi-core friendly</th>
- <td>Originally designed for single-threaded architectures and does not allow the generation of graphic commands in parallel to command execution.</td>
- <td>API is designed around asynchronous generation of command buffers across multiple threads and feeds them in sequence to a command pipeline, which reflects the realities of the modern hardware.</td>
-</tr>
-<tr>
- <th>High efficiency</th>
- <td>Does a lot of redundant excessive validation for each draw call, such as runtime error checking, implicit tracking of resource usage, and synchronization, leading to much CPU overhead.</td>
- <td>Vulkan&reg; greatly reduces the CPU time spent in the driver with external validation and diagnostics layers that can be independently enabled and disabled, as needed. Offloads the render thread by delegating heavy CPU jobs to the application and opt-in layers.</td>
-</tr>
-<tr>
- <th>Shader portability</th>
- <td>Only GLSL is supported as a shader language, and the compiler is a part of the driver with vendor-specific semantics. No user control over the front end and higher runtime translation time.</td>
- <td>Vulkan&reg; mandates the use of the intermediate byte code (SPIR-V) by the driver for shaders. This allows offline shader precompilation, and allows you to write shaders in languages other than GLSL.</td>
-</tr>
-<tr>
- <th>Code complexity</th>
- <td>OpenGL&reg; driver manages many tasks inside the driver relieving you from the burden of managing these at the application end.</td>
- <td>Vulkan&reg; is a much more verbose API, offering more control at the cost of more code complexity and responsibility at the application side.</td>
-</tr>
-</tbody>
-</table>
-
-<h2 id="sdl">SDL</h2>
-
-<p>SDL (Simple DirectMedia Layer) is a cross-platform software development library. In Tizen, it enables access to graphics hardware using Vulkan&reg;. SDL is used for creating high-performance computer games, multimedia applications, and emulators. It provides a low-level hardware abstraction layer to computer multimedia hardware components. It can run on many operating systems, such as Android&trade;, iOS, Linux, macOS, Windows&reg;, and Tizen. For more information, see the <a href="https://libsdl.org/" target="_blank">SDL Web site</a>.</p>
-
-<p>You can manage video, audio, some input devices, threads, and timers with SDL. Tizen supports SDL to provide new means of accessing its 3D APIs (Vulkan), which can currently be accessed only through an EFL wrapper library (Evas GL). For more information on Evas GL, see the <a href="../graphics/opengl_n.htm">OpenGL&reg; ES</a> guide.</p>
-
-<p>The following SDL features are currently supported in Tizen:</p>
-<ul>
-<li>SDL basics function
-<p>Use the <code>SDL.h</code>, <code>SDL_hints.h</code>, <code>SDL_error.h</code>, <code>SDL_log.h</code>, <code>SDL_assert.h</code>, <code>SDL_version.h</code>, <code>SDL_error.h</code>, and <code>SDL_stdinc.h</code> header files.</p></li>
-<li>Display and window management
-<p>Use the <code>SDL_video.h</code> and <code>SDL_syswm.h</code> header files.</p></li>
-<li>Event handling
-<p>Use the <code>SDL_events.h</code> and <code>SDL_keyboard.h</code> header files.</p></li>
-<li>Audio device management
-<p>Use the <code>SDL_audio.h</code> header file.</p></li>
-<li>Thread and timer management
-<p>Use the <code>SDL_thread.h</code>, <code>SDL_mutex.h</code>, <code>SDL_atomic.h</code>, and <code>SDL_timer.h</code> header files.</p></li>
-<li>Platform and power information
-<p>Use the <code>SDL_platform.h</code> and <code>SDL_power.h</code> header files.</p></li>
-</ul>
-<p>For the list of features not currently supported in Tizen, see the SDL API (in <a href="../../../../org.tizen.native.mobile.apireference/group__OPENSRC__SDL__FRAMEWORK.html">mobile</a> and <a href="../../../../org.tizen.native.wearable.apireference/group__OPENSRC__SDL__FRAMEWORK.html">wearable</a> applications).</p>
-
-<h3 id="lifecycle">SDL Application Life-cycle in Tizen</h3>
-
-<p>The Tizen native application model is responsible for the application life-cycle and system events. The SDL application life-cycle is handled by the <code>SDL_PollEvent()</code> function, which manages the main event loop, the application state change events, and basic system events (<a href="#SDL_event">general</a> and <a href="#tizen_event">Tizen-specific</a>).</p>
-
-<p align="center"><strong>Figure: SDL application life-cycle</strong></p>
-<p align="center"><img alt="SDL application life-cycle" src="../../images/sdl_statemodel.png" /></p>
-
-<p>The SDL application can be in one of several different states, and the state changes are managed by the underlying framework.</p>
-
-<p align="center" class="Table"><strong>Table: SDL application states</strong></p>
-<table>
-<tbody>
-<tr>
- <th>State</th>
- <th>Description</th>
-</tr>
-<tr>
- <td>READY</td>
- <td>Application starts the main loop.</td>
-</tr>
-<tr>
- <td>CREATED</td>
- <td>Application is launched.</td>
-</tr>
-<tr>
- <td>RUNNING</td>
- <td>Application is running and visible to the user.</td>
-</tr>
-<tr>
- <td>PAUSED</td>
- <td>Application is running but invisible to the user.</td>
-</tr>
-<tr>
- <td>TERMINATED</td>
- <td>Application is terminated.</td>
-</tr>
-</tbody>
-</table>
-
-
-<p>Typically, the application is launched by the user from the Launcher, or by another application. The application is normally launched as the top window, with focus. When the application loses the focus status, the <code>SDL_APP_WILLENTERBACKGROUND</code> and <code>SDL_APP_DIDENTERBACKGROUND</code> events are invoked. The application can go into the pause state, which means that it is not terminated but continues to run in the background. The pause state can happen when:</p>
-<ul>
-<li>A new application is launched by the request of your application.</li>
-<li>The user requests to go to the home screen.</li>
-<li>A system event (such as an incoming phone call) occurs and causes a resident application with a higher priority to become active and temporarily hide your application.</li>
-<li>An alarm is triggered for another application, which becomes the topmost window and hides your application.</li>
-</ul>
-
-<p>When the application becomes visible again, the <code>SDL_APP_WILLENTERFOREGROUND</code> and <code>SDL_APP_DIDENTERFOREGROUND</code> events are invoked. The visibility returns, when:</p>
-<ul>
-<li>Another application requests your application to run (such as the Task Navigator, which shows all running applications and lets user select any application to run).</li>
-<li>All applications on top of your application in the window stack finish.</li>
-<li>An alarm is triggered for your application, bringing it to the front and hiding other applications.</li>
-</ul>
-
-<p>When the application starts exiting, the <code>SDL_Quit</code> and <code>SDL_TERMINATING</code> events are invoked. Your application can start the termination process, when:</p>
-<ul>
-<li>The application itself requests to exit by calling the <code>ui_app_exit()</code> or <code>service_app_exit()</code> function to terminate the event loop.</li>
-<li>The low memory killer is terminating your application in a low memory situation.</li>
-</ul>
-
 
 <h2 id="prerequisites">Prerequisites</h2>
 
@@ -256,7 +120,7 @@ SDL_main(int argc, char *argv[])
 {
     SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS);
     demo.sdl_window = SDL_CreateWindow("SDL Vulkan Sample", 0, 0, demo.sdl_mode.w, demo.sdl_mode.h,
-                                       SDL_WINDOW_SHOWN | SDL_WINDOW_FULLSCREEN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_VULKAN);
+                                       SDL_WINDOW_SHOWN | SDL_WINDOW_FULLSCREEN | SDL_WINDOW_VULKAN);
 }
 </pre>
 </li>
@@ -505,188 +369,6 @@ SDL_Quit();
 </pre>
 </li>
 </ol>
-<h2 id="SDL_event">Handling General SDL Events</h2>
-
-<p>To handle general SDL events:</p>
-
-<ol>
-<li>Call the <code>SDL_PollEvent()</code> function, which polls the currently pending events and returns the <code>SDL_Event</code> instance. Before calling the <code>SDL_PollEvent()</code> function, create an empty <code>SDL_Event</code> structure.
-<pre class="prettyprint">
-void
-updateApp(appdata_s* ad)
-{
-    /* SDL_Event is a union containing structures for different event types */
-    SDL_Event event;
-    while (SDL_PollEvent(&amp;event)) {
-        SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL] Event type: %x\n", event.type);
-        handleEvent(&amp;ad, &amp;event);
-    }
-}
-</pre>
-</li>
-<li>The <code>SDL_PollEvent()</code> function removes the next event from the event queue. If there is no event in the queue, it returns 0. If there is an event, it fills the <code>SDL_Event</code> object with the event information.
-<p>The <code>SDL_Event</code> object is a union that contains structures for the different event types. The <code>type</code> member specifies the event type, shared with all events. The <code>type</code> member is related to the <a href="https://wiki.libsdl.org/SDL_EventType" target="blank">SDL_EventType</a> enumeration.</p>
-<p>To handle each event type separately, use a switch statement:</p>
-
-<pre class="prettyprint">
-void
-handleEvent(appdata_s** data, SDL_Event* event)
-{
-    appdata_s* ad = *data;
-
-    switch (event-&gt;type) {
-    case SDL_QUIT:
-        SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL] Finish main loop ");
-        ad-&gt;game_exit = 1;
-        break;
-    case SDL_KEYUP:
-        char* scancodename = (char *)SDL_GetScancodeName(event-&gt;key.keysym.scancode);
-        SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL] keyboard scancode: %s", scancodename);
-        if (event-&gt;key.keysym.scancode == SDL_SCANCODE_AC_BACK) {
-            SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL] Finish main loop ");
-            ad-&gt;game_exit = 1;
-        }
-        break;
-    case SDL_MOUSEBUTTONDOWN:
-        SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL]Mouse Down: %d x %d", event-&gt;button.x, event-&gt;button.y);
-        break;
-    case SDL_MOUSEBUTTONUP:
-        SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL]Mouse Up: %d x %d", event-&gt;button.x, event-&gt;button.y);
-        break;
-    case SDL_MOUSEMOTION:
-        SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL]Mouse Motion: %d x %d", event-&gt;motion.x, event-&gt;motion.y);
-        break;
-    case SDL_ROTATEEVENT:
-        ad-&gt;window_rotation = (int)event-&gt;user.data1;
-        SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL] Rotation degree: %d", ad-&gt;window_rotation);
-        break;
-    case SDL_WINDOWEVENT:
-        SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "SDL_WINDOWEVENT Event!!");
-        if (event-&gt;window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
-            SDL_Log("SDL_WINDOWEVENT_SIZE_CHANGED!!!");
-        break;
-    } /* End switch */
-}
-</pre>
-</li>
-</ol>
-
-<h2 id="tizen_event">Handling Tizen-specific SDL Events</h2>
-
-<p>To handle SDl events specifically added to the Tizen application framework:</p>
-
-<ul>
-<li><code>SDL_APP_CONTROL</code>
-<p>This event is invoked when the application is launched with some parameters. In Tizen, this event is called in the <code>_tizen_sdl_control()</code> function.</p>
-
-<p>The application framework calls the application's application control callback just after the application enters the main loop. This callback is passed to the <code>app_control</code> instance containing the reason why the application was launched. For example, the application can be launched to open a file to handle the request that has been sent by another application. In any case, the application is responsible for checking the <code>app_control</code> content and responding appropriately. The <code>app_control</code> content can be empty, if the application is launched from the launcher.</p>
-<p>In SDL, <code>SDL_APP_CONTROL</code> has been defined as a new <code>SDL_Event</code> event type for the application control. After the application enters the main loop, SDL sends the <code>SDL_APP_CONTROL</code> event to the application. This means that the application can confirm the <code>SDL_Event</code> in the event loop. The event is defined as an <code>SDL_UserEvent</code>, which is in the <code>user</code> member of the <code>SDL_Event</code> union.</p>
-
-<p>The <code>user</code> structure contains <code>data1</code> (<code>app_control</code>) and <code>data2</code> (<code>user_data</code>).</p>
-
-<p>In Tizen, you must include the <code>&lt;app.h&gt;</code> header file to use the application control. For more information, see the <a href="../app_management/app_controls_n.htm">Application Controls</a> guide.</p>
-<pre class="prettyprint">
-#include &lt;app.h&gt;
-
-case SDL_APP_CONTROL:
-    app_control_h app_control = event.user.data1;
-    void *user_data = event.user.data2;
-
-    char *operation;
-    char *uri;
-
-    app_control_get_operation(app_control, &amp;operation);
-    if (!strcmp(operation, APP_CONTROL_OPERATION_VIEW)) {
-        app_control_get_uri(app_control, &amp;uri);
-        app_control_get_extra_data(app_control, "action", &amp;action);
-        SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Get path: [%s], action: [%s]", uri, action);
-    }
-break;
-</pre>
-</li>
-<li><code>SDL_APP_LOWBATTERY</code>
-<p>This event is invoked when the application is low on battery. Use it to reduce power consumption, if possible. In Tizen, this event is called in the <code>_tizen_app_low_battery()</code> function.</p>
-<p>Get the low battery status from the given event info by calling the <code>app_event_get_low_battery_status()</code> function. The <code>app_event_low_battery_status_e</code> is the enumeration for the battery status: <code>APP_EVENT_LOW_BATTERY_POWER_OFF</code> means that the battery charge is under 1% and <code>APP_EVENT_LOW_BATTERY_CRITICAL_LOW</code> under 5%.</p>
-
-<pre class="prettyprint">
-#include &lt;app.h&gt;
-
-case SDL_APP_LOWBATTERY:
-    SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL] SDL_APP_LOWBATTERY ");
-
-    app_event_info_h event_info = event-&gt;user.data1;
-    void *user_data = event-&gt;user.data2;
-
-    app_event_low_battery_status_e status;
-    int ret = app_event_get_low_battery_status(event_info, &amp;status);
-    if (ret == APP_ERROR_NONE) {
-        if (status == APP_EVENT_LOW_BATTERY_POWER_OFF)
-            SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL] The battery status is under 1% ");
-        else if (status == APP_EVENT_LOW_BATTERY_CRITICAL_LOW)
-            SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL] The battery status is under 5% ");
-    }
-    break;
-</pre>
-</li>
-<li><code>SDL_APP_LANGUAGE_CHANGED</code>
-<p>This event is invoked when the displayed language is changed by the system. In Tizen, this event is called in the <code>_tizen_app_lang_changed()</code> function.</p>
-<p>Get the language from the given event info by calling the <code>app_event_get_language()</code> function.</p>
-<pre class="prettyprint">
-#include &lt;app.h&gt;
-
-case SDL_APP_LANGUAGE_CHANGED:
-    SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL] SDL_APP_LANGUAGE_CHANGED ");
-
-    app_event_info_h event_info = event-&gt;user.data1;
-    void *user_data = event-&gt;user.data2;
-
-    char *language;
-    int ret = app_event_get_language(event_info, &amp;language);
-    if (ret != APP_ERROR_NONE)
-        SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL] app_event_get_language failed. Err = %d ", ret);
-
-    if (language != NULL) {
-        SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL] language:  ", language);
-        free(language);
-    }
-    break;
-</pre>
-</li>
-<li><code>SDL_ROTATEEVENT</code>
-<p>This event is invoked when the device orientation changes. In Tizen, this event is called in the <code>_tizen_app_orient_changed()</code> function.</p>
-<p>Tizen supports portrait and landscape screen orientations, and you must take care of how your application responds to rotation changes. Use the <code>SDL_SetHint()</code> function to set the orientations with <code>SDL_HINT_ORIENTATIONS</code>. A hint specifies a variable controlling which orientations are allowed in Tizen.</p>
-
-<p align="center" class="Table"><strong>Table: Allowed orientations</strong></p>
-<table>
-<tbody>
-<tr>
- <th>Orientation</th>
- <th>Description</th>
-</tr>
-<tr>
- <td><code>LandscapeLeft</code></td>
- <td>Top of the device on the left</td>
-</tr>
-<tr>
- <td><code>LandscapeRight</code></td>
- <td>Top of the device on the right</td>
-</tr>
-<tr>
- <td><code>Portrait</code></td>
- <td>Top of device up</td>
-</tr>
-</tbody>
-</table>
-<pre class="prettyprint">
-SDL_SetHint(SDL_HINT_ORIENTATIONS, "Portrait LandscapeLeft LandscapeRight");
-
-case SDL_ROTATEEVENT:
-    ad-&gt;window_rotation = (int)event-&gt;user.data1;
-    SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL] Rotation degree: %d", ad-&gt;window_rotation);
-    break;
-</pre>
-</li>
-</ul>
 
 <script type="text/javascript" src="../../scripts/jquery.zclip.min.js"></script>
 <script type="text/javascript" src="../../scripts/showhide.js"></script>
index 1e21da2..951c133 100644 (file)
                        <topic href="html/native/graphics/adv_rendering_n.htm" label="Advanced Rendering"></topic>
                        <topic href="html/native/graphics/adv_performance_n.htm" label="Advanced Performance"></topic>
                </topic>
-               <topic href="html/native/graphics/vulkan_n.htm" label="SDL Graphics with Vulkan&#174;"></topic>
+               <topic href="html/native/graphics/sdl_n.htm" label="Simple DirectMedia Layer (SDL)">
+                       <topic href="html/native/graphics/vulkan_n.htm" label="SDL Graphics with Vulkan&#174;"></topic>
+                       <topic href="html/native/graphics/sdl_opengles_n.htm" label="SDL Graphics with OpenGL&#174; ES"></topic>
+               </topic>
        </topic>
        <topic href="html/native/notification/notification_cover_n.htm" label="Notifications and Content Sharing">
                <topic href="html/native/notification/noti_n.htm" label="Notifications"></topic>
index 173a347..2dbba76 100644 (file)
        <td>2.4</td>
     </tr>
 <tr>
+<td><code>http://tizen.org/feature/opengles.version.3_1</code></td>
+     <td>Specify this key, if the application requires OpenGL&reg; ES version 3.1.
+        <p>You can specify at most 1 OpenGL&reg; ES version. If you specify multiple versions, only the highest one is considered.</p>
+       </td>
+       <td rowspan="2">4.0</td>
+    </tr>
+<tr>
+<td><code>http://tizen.org/feature/opengles.version.3_2</code></td>
+     <td>Specify this key, if the application requires OpenGL&reg; ES version 3.2.
+        <p>You can specify at most 1 OpenGL&reg; ES version. If you specify multiple versions, only the highest one is considered.</p>
+       </td>
+    </tr>
+<tr>
 <td><code>http://tizen.org/feature/platform.core.cpu.arch.armv7</code></td>
      <td>Specify this key, if the application requires the ARMv7 CPU architecture.</td>
         <td>2.2.1</td>