Skip to content

Commit 93f97f5

Browse files
Robert LyAndroid (Google) Code Review
authored andcommitted
Merge "docs: rs link fixes" into ics-mr0
2 parents 9088982 + 8497593 commit 93f97f5

File tree

1 file changed

+32
-16
lines changed

1 file changed

+32
-16
lines changed

docs/html/guide/topics/renderscript/graphics.jd

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,26 @@ parent.link=index.html
99

1010
<ol>
1111
<li>
12-
<a href="#developing">Developing a RenderScript application</a>
13-
12+
<a href="#creating-graphics-rs">Creating a Graphics Renderscript</a>
13+
<ol>
14+
<li><a href="#creating-native">Creating the native Renderscript file</a></li>
15+
<li><a href="#creating-entry">Creating the Renderscript entry point class</a></li>
16+
<li><a href="#creating-view">Creating the surface view</a></li>
17+
<li><a href="#creating-activity">Creating the activity</a></li>
18+
</ol>
19+
</li>
20+
<li>
21+
<a href="#drawing">Drawing</a>
1422
<ol>
15-
<li><a href="#hello-graphics">The Hello Graphics application</a></li>
23+
<li><a href="#drawing-rsg">Drawing using the rsgDraw functions</a></li>
24+
<li><a href="#drawing-mesh">Drawing with a mesh</a></li>
25+
</ol>
26+
</li>
27+
<li>
28+
<a href="#shaders">Shaders</a>
29+
<ol>
30+
<li><a href="#shader-bindings">Shader bindings</a></li>
31+
<li><a href="#shader-sampler">Defining a sampler</a></li>
1632
</ol>
1733
</li>
1834
</ol>
@@ -40,7 +56,7 @@ href="{@docRoot}resources/samples/RenderScript/MiscSamples/index.html">Misc Samp
4056
will need to be familiar with APIs to appropriately render 3D graphics on an Android-powered
4157
device.</p>
4258

43-
<h2>Creating a Graphics RenderScript</h2>
59+
<h2 id="creating-graphics-rs">Creating a Graphics RenderScript</h2>
4460

4561
<p>Because of the various layers of code when writing a RenderScript application, it is useful to
4662
create the following files for a scene that you want to render:</p>
@@ -73,7 +89,7 @@ href="{@docRoot}resources/samples/RenderScript/MiscSamples/index.html">Misc Samp
7389
RenderScript sample that is provided in the SDK as a guide (some code has been modified from its
7490
original form for simplicity).</p>
7591

76-
<h3>Creating the native RenderScript file</h3>
92+
<h3 id="creating-native">Creating the native RenderScript file</h3>
7793

7894
<p>Your native RenderScript code resides in a <code>.rs</code> file in the
7995
<code>&lt;project_root&gt;/src/</code> directory. You can also define <code>.rsh</code> header
@@ -102,8 +118,8 @@ href="{@docRoot}resources/samples/RenderScript/MiscSamples/index.html">Misc Samp
102118
enough or more resources to do so, and renders as fast as it can if it does not.</p>
103119

104120
<p>For more
105-
information on using the RenderScript graphics functions, see <a href=
106-
"using-graphics-api">Using the Graphics APIs</a>.</p>
121+
information on using the RenderScript graphics functions, see the <a href=
122+
"#drawing">Drawing</a> section.</p>
107123
</li>
108124

109125
<li>An <code>init()</code> function. This allows you to do any initialization of your
@@ -153,7 +169,7 @@ int root(int launchID) {
153169
}
154170
</pre>
155171

156-
<h3>Creating the RenderScript entry point class</h3>
172+
<h3 id="creating-entry">Creating the RenderScript entry point class</h3>
157173

158174
<p>When you create a RenderScript (<code>.rs</code>) file, it is helpful to create a
159175
corresponding Android framework class that is an entry point into the <code>.rs</code> file. In
@@ -218,7 +234,7 @@ public class HelloWorldRS {
218234

219235
</pre>
220236

221-
<h3>Creating the surface view</h3>
237+
<h3 id="creating-view">Creating the surface view</h3>
222238

223239
<p>To create a surface view to render graphics on, create a class that extends {@link
224240
android.renderscript.RSSurfaceView}. This class also creates a RenderScript context object
@@ -293,7 +309,7 @@ public class HelloWorldView extends RSSurfaceView {
293309

294310
</pre>
295311

296-
<h3>Creating the Activity</h3>
312+
<h3 id="creating-activity">Creating the Activity</h3>
297313

298314
<p>Applications that use RenderScript still adhere to activity lifecyle, and are part of the same
299315
view hierarchy as traditional Android applications, which is handled by the Android VM. This
@@ -329,9 +345,9 @@ public class HelloWorldActivity extends Activity {
329345
}
330346
</pre>
331347

332-
<h2>Drawing</h2>
333-
334-
<h3>Drawing using the rsgDraw functions</h3>
348+
<h2 id="drawing">Drawing</h2>
349+
<p>The following sections describe how to use the graphics functions to draw with Renderscript.</p>
350+
<h3 id="drawing-rsg">Drawing using the rsgDraw functions</h3>
335351

336352
<p>The native RenderScript APIs provide a few convenient functions to easily draw a polygon to
337353
the screen. You call these in your <code>root()</code> function to have them render to the
@@ -348,7 +364,7 @@ public class HelloWorldActivity extends Activity {
348364
the screen.</li>
349365
</ul>
350366

351-
<h3>Drawing with a mesh</h3>
367+
<h3 id="drawing-mesh">Drawing with a mesh</h3>
352368

353369
<p>When you want to draw complex shapes and textures to the screen, instantiate a {@link
354370
android.renderscript.Mesh} and draw it to the screen with <code>rsgDrawMesh()</code>. A {@link
@@ -559,7 +575,7 @@ return 0; //specify a non zero, positive integer to specify the frame refresh.
559575
"{@docRoot}resources/samples/RenderScript/MiscSamples/src/com/example/android/rs/miscsamples/RsRenderStatesRS.html">
560576
RsRenderStatesRS</a> sample has many examples on how to create a shader without writing GLSL.</p>
561577

562-
<h3>Shader bindings</h3>
578+
<h3 id="shader-bindings">Shader bindings</h3>
563579

564580
<p>You can also set four pragmas that control the shaders' default bindings to the {@link
565581
android.renderscript.RenderScriptGL} context when the script is executing:</p>
@@ -599,7 +615,7 @@ return 0; //specify a non zero, positive integer to specify the frame refresh.
599615
#pragma stateStore(parent)
600616
</pre>
601617

602-
<h3>Defining a sampler</h3>
618+
<h3 id="shader-sampler">Defining a sampler</h3>
603619

604620
<p>A {@link android.renderscript.Sampler} object defines how data is extracted from textures.
605621
Samplers are bound to Program objects (currently only a Fragment Program) alongside the texture

0 commit comments

Comments
 (0)