1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
3  <head>
4    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5    <meta http-equiv="Content-Style-Type" content="text/css" />
6    <link rel="stylesheet" href="../css/document.css" type="text/css" />
7    <title>Using NintendoWare Together with GL</title>
8  </head>
9  <body>
10
11
12    <h1>Notes Regarding the Use of NintendoWare for CTR Together With DMPGL</h1>
13
14<a href="#introduction">Introduction</a><BR> <a href="#dmpgl">Drawing with DMPGL</a><BR> <a href="#graphics" >Drawing Graphics</a><BR> <a href="#layout">Drawing Layouts (Fonts)</a><BR> <a href="#pseudo_code">Pseudo-code</a><BR> <a href="#framebuffer">Frame Buffer Operations</a><BR>
15
16<h2><a name="introduction">Introduction</a></h2>
17
18    <p>This document is a collection of notes regarding the use of NintendoWare for CTR (henceforth called NW4C) together with DMPGL.</p>
19
20    <p>To improve the performance of NW4C, from version 0.7.0 there are commands directly generated without using DMPGL for interpretation by the GPU. For this reason, you must follow set procedures when using NW4C and DMPGL.</p>
21
22    <p>If you need more information about using DMPGL together with directly generated  commands, see the following documentation:</p>
23
24    <ul>
25    <li><a href="combine_gpu_command_with_gl.html">Notes About Creating GPU Commands and Using Them With DMPGL</a></li>
26    </ul>
27
28    <p>If you need more information about the direct generation of commands, see the following documentation, which is included in the CTR-SDK:</p>
29
30    <ul>
31    <li>DMPGL2.0 System API Specifications, Chapter 5 (DMPGL20_system_API_specification.pdf).</li>
32    </ul>
33
34<h2><a name="framebuffer">Frame Buffer Operations</a></h2>
35
36Under NW4C, the command for setting the frame buffer is issued directly to the GPU without invoking glBindFramebuffer under the RenderContext::SetRenderTarget namespace. glBindFramebuffer must be called separately and explicitly, if the application is executing gl functions that impact the frame buffer, such as glClear and glDrawElements.
37
38<pre>
39    glBindFramebuffer( GL_FRAMEBUFFER,  renderTarget-&gt;GetBufferObject()
40    glClear(mask);
41</pre>
42
43
44<h2><a name="dmpgl">Drawing with DMPGL</a></h2>
45
46    <p>States are updated when DMPGL is called after the drawing of NW4C graphics, layouts and fonts.</p>
47
48<pre>
49    Drawing graphics, layouts and fonts
50    nngxUpdateState(NN_GX_STATE_ALL);
51    Drawing with DMPGL
52</pre>
53
54      <p>After DMPGL is called, the state is validated when drawing NW4C graphics, NW4C layouts or NW4C fonts.</p>
55
56	<pre>
57    nngxValidateState(NN_GX_STATE_ALL, false);
58    Drawing graphics, layouts and fonts
59	</pre>
60
61
62<h2><a name="graphics">Drawing graphics</a></h2>
63<p>States are reset before drawing of graphics.</p>
64
65	<pre>
66    RenderContext::ResetState();
67    Drawing graphics
68	</pre>
69
70<h2><a name="layout">Drawing Layouts (Fonts)</a></h2>
71
72    <p>Before drawing a layout (or font), be sure to first set all parameters not set for layouts (or fonts), such as polygon culling and depth testing.</p>
73
74    <p>For details on how to set parameters not set for layouts (or fonts), see the Reference Manual entry for the nw::lyt::Drawer class. Also, see the layout demo sample for specific examples of making settings.</p>
75
76	<pre>
77    Culling polygon faces and depth test settings
78    Draw layout (or font)
79	</pre>
80
81<h2><a name="pseudo_code">Pseudo-code</a></h2>
82
83<h3>Pseudo-code for Drawing Layouts After Drawing Graphics</h3>
84
85<pre>
86while (true)
87{
88    RenderContext::ResetState();
89    Drawing graphics
90
91    Culling polygon faces, depth test settings, and so on
92    Drawing layouts
93}
94</pre>
95
96    <h3>Pseudo-code for Drawing with DMPGL After Drawing Graphics</h3>
97
98<pre>
99while (true)
100{
101    RenderContext::ResetState();
102    Drawing graphics
103
104    nngxUpdateState(NN_GX_STATE_ALL)
105    Drawing with DMPGL
106}
107</pre>
108
109    <h3>Pseudo-code for Drawing Graphics After Drawing Layouts</h3>
110
111<pre>
112while (true)
113{
114    Culling polygon faces, depth test settings, and so on
115    Drawing layouts
116
117    RenderContext::ResetState();
118    Drawing graphics
119}
120</pre>
121
122    <h3>Pseudo-code for Drawing Graphics After Drawing Layouts</h3>
123
124<pre>
125while (true)
126{
127    Culling polygon faces, depth test settings, and so on
128    Drawing layouts
129
130    nngxUpdateState(NN_GX_STATE_ALL);
131    Drawing with DMPGL
132}
133</pre>
134
135    <h3>Pseudo-code for Drawing Graphics After Drawing with DMPGL</h3>
136
137<pre>
138while (true)
139{
140    nngxUpdateState(NN_GX_STATE_ALL);
141    Drawing with DMPGL
142
143    RenderContext::ResetState();
144    Drawing graphics
145}
146</pre>
147
148    <h3>Pseudo-code for Drawing Layouts After Drawing with DMPGL</h3>
149
150<pre>
151while (true)
152{
153    nngxUpdateState(NN_GX_STATE_ALL);
154    Drawing with DMPGL
155
156    Culling polygon faces, depth test settings, and so on
157    Drawing layouts
158}
159</pre>
160
161
162  <hr><p>CONFIDENTIAL</p></body>
163</html>
164
165