Skip to content

Commit 51821da

Browse files
author
Alfonse
committed
Code verified on Windows with Catalyst 12.1 drivers.
A couple of errors were fixed.
1 parent 2f06339 commit 51821da

File tree

7 files changed

+41
-21
lines changed

7 files changed

+41
-21
lines changed

Documents/Illumination/Tutorial 13.xml

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -166,16 +166,13 @@ void main()
166166
we transform the camera-space position to clip-space as normal.</para>
167167
<para>The output <varname>mapping</varname> is a value that is used by the fragment
168168
shader, as we will see below.</para>
169-
<para>Since this vertex shader takes no inputs, you might think that you could get away
170-
with binding a vertex array object that had no enabled attributes. Alas, this does
171-
not work; we must have a dummy attribute enabled and a dummy buffer object to pull
172-
data from. We do this in the initialization function of this tutorial.</para>
173-
<note>
174-
<para>The OpenGL 3.3 core specification is quite clear that it should be possible to
175-
render with no enabled attributes. Sadly, certain implementations of OpenGL
176-
(*cough*AMD*cough*) incorrectly forbid it, so our tutorial has to work around
177-
them.</para>
178-
</note>
169+
<para>Since this vertex shader takes no inputs, our vertex array object does not need to
170+
contain anything either. That is, we never call
171+
<function>glEnableVertexAttribArray</function> on the VAO. Since no attribute
172+
arrays are enabled, we also have no need for a buffer object to store vertex array
173+
data. So we never call <function>glVertexAttribPointer</function>. We simply
174+
generate an empty VAO with <function>glGenVertexArrays</function> and use it without
175+
modification.</para>
179176
</section>
180177
<section>
181178
<title>Racketeering Rasterization</title>
@@ -916,6 +913,12 @@ uniform Material
916913
<title>Further Study</title>
917914
<para>Try doing these things with the given programs.</para>
918915
<itemizedlist>
916+
<listitem>
917+
<para>The first version of our impostors was a sphere approximation. It was not
918+
useful for relatively large spheres, but it could be useful for small ones.
919+
However, that approximation did not compute the depth of the fragment
920+
correctly. Make a version of it that does.</para>
921+
</listitem>
919922
<listitem>
920923
<para>Change the geometry impostor tutorial to take another vertex input: the
921924
material to use. The vertex shader should pass it along to the geometry
@@ -939,9 +942,11 @@ uniform Material
939942
<para>There are other impostor-based solutions. Most particle systems (a large and
940943
vibrant topic that you should investigate) use flat-cards to draw pictures that move
941944
through space. These images can animate, changing from one image to another based on
942-
time, and large groups of these particle can be used to simulate various phenomena
945+
time, and large groups of these particles can be used to simulate various phenomena
943946
like smoke, fire, and the like.</para>
944-
<para>All of these subjects are worthy of your time.</para>
947+
<para>All of these subjects are worthy of your time. Of course, moving pictures through
948+
space requires being able to draw pictures. That means textures, which
949+
coincidentally is the topic for our next section.</para>
945950
</section>
946951
<section>
947952
<title>GLSL Features of Note</title>

Documents/Tutorial Documents.xpr

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2513,9 +2513,12 @@
25132513
<file name="chunked.css"/>
25142514
<file name="standard.css"/>
25152515
</folder>
2516+
<folder name="Schemas">
2517+
<file name="meshFormat.rnc"/>
2518+
<file name="sceneFormat.rnc"/>
2519+
</folder>
25162520
<file name="Building%20the%20Tutorials.xml"/>
25172521
<file name="cssDoc.txt"/>
2518-
<file name="meshFormat.rnc"/>
25192522
<file name="Outline.xml"/>
25202523
<file name="preface.xml"/>
25212524
<file name="Tutorials.xml"/>

Documents/preface.xml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,17 @@
130130
presented in the tutorial. It will also contain suggestions for playing with the source
131131
code itself; these are intended to further your understanding of these concepts. If the
132132
tutorial introduced new OpenGL functions or functions for the OpenGL shading language,
133-
they will be reviewed here as well. Each tutorial ends with a glossary of defined
134-
terms.</para>
133+
they will be reviewed here as well.</para>
134+
<para>This is a book for beginning graphics programmers. Graphics is a huge topic, and this
135+
book will not cover every possible effect, feature, or technique. This book will also
136+
not cover every technique in full detail. Sometimes techniques will be revisited in
137+
later materials, but there simply isn't enough space to say everything about everything.
138+
Therefore, when certain techniques are introduced, there will be a section at the end
139+
providing some cursory examination of more advanced techniques. This will help you
140+
further your own research into graphics programming, as you will know what to search for
141+
online or in other books.</para>
142+
<para>Each tutorial ends with a glossary of all of the terms defined in that
143+
tutorial.</para>
135144
<note condition="web">
136145
<title>Browser Note</title>
137146
<para>This website and these tutorials make extensive use of SVG images. Basic SVG

Tut 12 Dynamic Range/Gamma Correction.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ ProgramData LoadLitProgram(const std::string &strVertexShader, const std::string
9696
GLuint lightBlock = glGetUniformBlockIndex(data.theProgram, "Light");
9797
GLuint projectionBlock = glGetUniformBlockIndex(data.theProgram, "Projection");
9898

99-
glUniformBlockBinding(data.theProgram, materialBlock, g_materialBlockIndex);
99+
if(materialBlock != GL_INVALID_INDEX) //Can be optimized out.
100+
glUniformBlockBinding(data.theProgram, materialBlock, g_materialBlockIndex);
100101
glUniformBlockBinding(data.theProgram, lightBlock, g_lightBlockIndex);
101102
glUniformBlockBinding(data.theProgram, projectionBlock, g_projectionBlockIndex);
102103

Tut 12 Dynamic Range/HDR Lighting.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ ProgramData LoadLitProgram(const std::string &strVertexShader, const std::string
9696
GLuint lightBlock = glGetUniformBlockIndex(data.theProgram, "Light");
9797
GLuint projectionBlock = glGetUniformBlockIndex(data.theProgram, "Projection");
9898

99-
glUniformBlockBinding(data.theProgram, materialBlock, g_materialBlockIndex);
99+
if(materialBlock != GL_INVALID_INDEX) //Can be optimized out.
100+
glUniformBlockBinding(data.theProgram, materialBlock, g_materialBlockIndex);
100101
glUniformBlockBinding(data.theProgram, lightBlock, g_lightBlockIndex);
101102
glUniformBlockBinding(data.theProgram, projectionBlock, g_projectionBlockIndex);
102103

Tut 12 Dynamic Range/Scene Lighting.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ ProgramData LoadLitProgram(const std::string &strVertexShader, const std::string
9696
GLuint lightBlock = glGetUniformBlockIndex(data.theProgram, "Light");
9797
GLuint projectionBlock = glGetUniformBlockIndex(data.theProgram, "Projection");
9898

99-
glUniformBlockBinding(data.theProgram, materialBlock, g_materialBlockIndex);
99+
if(materialBlock != GL_INVALID_INDEX) //Can be optimized out.
100+
glUniformBlockBinding(data.theProgram, materialBlock, g_materialBlockIndex);
100101
glUniformBlockBinding(data.theProgram, lightBlock, g_lightBlockIndex);
101102
glUniformBlockBinding(data.theProgram, projectionBlock, g_projectionBlockIndex);
102103

Tut 13 Impostors/BasicImpostor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,9 @@ void init()
331331
glBufferData(GL_ARRAY_BUFFER, 4 * sizeof(float), NULL, GL_STATIC_DRAW);
332332

333333
glGenVertexArrays(1, &g_imposterVAO);
334-
glBindVertexArray(g_imposterVAO);
335-
glEnableVertexAttribArray(0);
336-
glVertexAttribPointer(0, 1, GL_FLOAT, GL_FALSE, 0, (void*)(0));
334+
// glBindVertexArray(g_imposterVAO);
335+
// glEnableVertexAttribArray(0);
336+
// glVertexAttribPointer(0, 1, GL_FLOAT, GL_FALSE, 0, (void*)(0));
337337

338338
glBindVertexArray(0);
339339
glBindBuffer(GL_ARRAY_BUFFER, 0);

0 commit comments

Comments
 (0)