Comment 4 for bug 1173355

Revision history for this message
Emmanuel (hacker-emmanuel) wrote :

The initial failed assertion issue of this bug report can be traced to file StelSphericalGeometry.cpp:

 319 //! @param texCoords Texture coordinates of vertices in the triangle.
 320 //! Must be NULL for this overload.
 321 void appendTriangle(StelVertexBuffer<SphericalRegion::PlainVertex>* buffer,
 322 const Triplet<Vec3f>& vertices, const Triplet<Vec2f>* t exCoords)
 323 {
 324 #ifndef NDEBUG
 325 Q_ASSERT_X(texCoords == NULL, Q_FUNC_INFO,
 326 "Got texCoords even though building buffer without textu re coords");

The appendTriangle method is improperly called from:

 360 template<class V>
 361 void projectSphericalTriangle
 ...
 430 appendTriangle(buffer, triangle, texCoords);

Which is itself called from:

 619 if (NULL != texCoords)
 620 {
 621 ta.a=(texCoords->a+texCoords->b)*0.5;
 622 ta.b=texCoords->b;
 623 ta.c=texCoords->c;
 624 }
 625 projectSphericalTriangle(projector, clippingCap, &va, texCoords ? &ta : 0, buffer, maxSqDistortion, nbI+1, true, false, true);

If texCoord is null, denoting that the vertex buffer was produced with no texture, a non-null texcoord pointer is nevertheless passed to appendTriangle() which according to comment on line 320 is not correct.

To fix this, calls like:
 625 projectSphericalTriangle(projector, clippingCap, &va, &ta, buffer, maxSqDistortion, nbI+1, true, false, true);
Could be replaced with:
 625 projectSphericalTriangle(projector, clippingCap, &va, texCoords ? &ta : 0, buffer, maxSqDistortion, nbI+1, true,

Otherwise, why not remove the assertion if there is no ill effect?