Jason McKesson avatar Jason McKesson committed aa4e174

Fix for a non-bug unearthed by our new debugging.

Comments (0)

Files changed (4)

Documents/Illumination/Tutorial 12.xml

             <para>When you use <function>glBindBufferRange</function> to bind a UBO, OpenGL requires
                 that the offset parameter, the parameter that tells where the beginning of the
                 uniform block's data is within the buffer object, be aligned to a specific value.
-                What value, you may ask?</para>
-            <para>Welcome to the world of implementation-dependent values. This means that it can
-                (and most certainly will) change depending on what platform you're running on. This
-                code was tested on two different hardware platforms; one has a minimum alignment of
-                64, the other an alignment of 256.</para>
+                That is, the begining of a uniform block within a uniform buffer must be a multiple
+                of a specific value. 0 works, of course, but since we have more than one block
+                within a uniform buffer, they can't all start at the buffer's beginning.</para>
+            <para>What is this value, you may ask? Welcome to the world of implementation-dependent
+                values. This means that it can (and most certainly will) change depending on what
+                platform you're running on. This code was tested on two different hardware
+                platforms; one has a minimum alignment of 64, the other an alignment of 256.</para>
             <para>To retrieve the implementation-dependent value, we must use a previously-unseen
                 function: <function>glGetIntegerv</function>. This is a function that does one
                 simple thing: gets integer values from OpenGL. However, the meaning of the value
                 retrieved depends on the enumerator passed as the first parameter. Basically, it's a
                 way to have state retrieval functions that can easily be extended by adding new
-                enumerators rather than new function entrypoints.</para>
+                enumerators rather than new functions.</para>
             <para>The code that builds the material uniform buffer is as follows:</para>
             <example>
                 <title>Material UBO Construction</title>

Tut 12 Dynamic Range/Scene.cpp

 	pMesh->Render();
 	glUseProgram(0);
 
-	glBindBufferRange(GL_UNIFORM_BUFFER, materialBlockIndex, 0, 0, 0);
+	glBindBufferBase(GL_UNIFORM_BUFFER, materialBlockIndex, 0);
 }
 
 void Scene::DrawObject(const Framework::Mesh *pMesh, const std::string &meshName, 
 	pMesh->Render(meshName);
 	glUseProgram(0);
 
-	glBindBufferRange(GL_UNIFORM_BUFFER, materialBlockIndex, 0, 0, 0);
+	glBindBufferBase(GL_UNIFORM_BUFFER, materialBlockIndex, 0);
 }
 
 

Tut 13 Impostors/BasicImpostor.cpp

 		glUseProgram(0);
 	}
 
-	glBindBufferRange(GL_UNIFORM_BUFFER, g_materialBlockIndex, 0, 0, 0);
+	glBindBufferBase(GL_UNIFORM_BUFFER, g_materialBlockIndex, 0);
 }
 
 void DrawSphereOrbit(Framework::MatrixStack &modelMatrix,
 			g_pPlaneMesh->Render();
 
 			glUseProgram(0);
-			glBindBufferRange(GL_UNIFORM_BUFFER, g_materialBlockIndex, 0, 0, 0);
+			glBindBufferBase(GL_UNIFORM_BUFFER, g_materialBlockIndex, 0);
 		}
 
 		DrawSphere(modelMatrix, glm::vec3(0.0f, 10.0f, 0.0f), 4.0f, MTL_BLUE_SHINY,

Tut 13 Impostors/GeomImpostor.cpp

 			g_pPlaneMesh->Render();
 
 			glUseProgram(0);
-			glBindBufferRange(GL_UNIFORM_BUFFER, g_materialBlockIndex, 0, 0, 0);
+			glBindBufferBase(GL_UNIFORM_BUFFER, g_materialBlockIndex, 0);
 		}
 
 		{
 			glBindVertexArray(0);
 			glUseProgram(0);
 
-			glBindBufferRange(GL_UNIFORM_BUFFER, g_materialBlockIndex, 0, 0, 0);
+			glBindBufferBase(GL_UNIFORM_BUFFER, g_materialBlockIndex, 0);
 		}
 
 		if(g_bDrawLights)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.