File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
src/apps/ch11_ssao/ch11_ssao Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,10 @@ std::string to_string(TextureStore::Name aName)
111111void drawPass (const renderer::IntrospectProgram & aProgram,
112112 const scenic::SceneTree & aSceneTree)
113113{
114+ // We populated the per-instance buffer in the order of the objects map interation
115+ // We keep track of the base-instance to access the correct index in the shader
116+ GLuint baseInstance = 0 ;
117+ const GLuint instanceCount = 1 ;
114118 glUseProgram (aProgram);
115119 for (const auto & [nodeIdx, object] : aSceneTree.mObjectsMap )
116120 {
@@ -126,14 +130,14 @@ void drawPass(const renderer::IntrospectProgram & aProgram,
126130 part.mIndicesCount ,
127131 part.mIndicesType ,
128132 (void *)part.mIndexFirst ,
129- 1 , // One instance
130- 0 /* base instance */ );
133+ instanceCount , // One instance
134+ baseInstance );
131135 }
132136 else
133137 {
134138 throw std::logic_error{ " Who is not using indexed rendering?" };
135139 }
136-
140+ baseInstance += instanceCount;
137141 }
138142 }
139143}
You can’t perform that action at this time.
0 commit comments