Fixes the bug of glShareTopology. This example mutates patchDescriptor in drawcontext, so it needs a write access.

Adding another GetPatchArray() returning non-const reference. We should think about better API for this.
This commit is contained in:
Takahito Tejima 2014-09-10 15:24:16 -07:00
parent 7462ae20ff
commit b3f6f52bb9
2 changed files with 8 additions and 2 deletions

View File

@ -260,12 +260,12 @@ public:
protected:
TopologyBase(Far::PatchTables const * patchTables) {
_drawContext = Osd::GLDrawContext::Create(patchTables, 7);
}
void updateVertexBufferStride(int stride) {
Osd::DrawContext::PatchArrayVector patchArrays =
// modifying patchArrays in drawcontext.
Osd::DrawContext::PatchArrayVector &patchArrays =
_drawContext->GetPatchArrays();
for (int i = 0; i < (int)patchArrays.size(); ++i) {
Osd::DrawContext::PatchDescriptor desc = patchArrays[i].GetDescriptor();

View File

@ -212,6 +212,12 @@ public:
return _patchArrays;
}
/// The writable accessor to the internal patch array (tentative).
/// We should have a different api something like ConvertPatchArrays().
PatchArrayVector &GetPatchArrays() {
return _patchArrays;
}
// processes FarPatchArrays and inserts requisite sub-patches for the arrays
// containing transition patches
static void ConvertPatchArrays(Far::PatchTables::PatchArrayVector const &farPatchArrays,