Program: 58943
Project: 58943
Buggy source:
/** 
 * Render a curved (nice looking) connection line from given start point to given end point
 * @param gl
 * @param startpoint
 * @param endpoint
 */
private void renderSelectedDomain(GL gl,Vec3f startpoint1,Vec3f endpoint1,Vec3f startpoint2,Vec3f endpoint2){
  float fthickness=(endpoint1.x() - startpoint1.x()) / 4;
  float fScalFactor1, fScalFactor2;
  if (endpoint1.y() - startpoint1.y() < 0.2f)   fScalFactor1=(endpoint1.y() - startpoint1.y()) * 5f;
 else   fScalFactor1=1;
  if (startpoint2.y() - endpoint2.y() < 0.2f)   fScalFactor2=(startpoint2.y() - endpoint2.y()) * 5f;
 else   fScalFactor2=1;
  gl.glColor4f(0f,0f,0f,0.45f);
  gl.glBegin(GL.GL_QUADS);
  gl.glVertex3f(startpoint1.x(),startpoint1.y(),startpoint1.z());
  gl.glVertex3f(startpoint1.x() + 2 * fthickness,startpoint1.y(),startpoint1.z());
  gl.glVertex3f(startpoint2.x() + 2 * fthickness,startpoint2.y(),startpoint2.z());
  gl.glVertex3f(startpoint2.x(),startpoint2.y(),startpoint2.z());
  gl.glEnd();
  gl.glBegin(GL.GL_QUADS);
  gl.glVertex3f(endpoint1.x(),endpoint1.y(),endpoint1.z());
  gl.glVertex3f(endpoint1.x() - 1 * fthickness,endpoint1.y(),endpoint1.z());
  gl.glVertex3f(endpoint2.x() - 1 * fthickness,endpoint2.y(),endpoint2.z());
  gl.glVertex3f(endpoint2.x(),endpoint2.y(),endpoint2.z());
  gl.glEnd();
  gl.glBegin(GL.GL_QUADS);
  gl.glVertex3f(endpoint1.x() - 1 * fthickness,endpoint1.y() - 0.1f * fScalFactor1,endpoint1.z());
  gl.glVertex3f(endpoint1.x() - 2 * fthickness,endpoint1.y() - 0.1f * fScalFactor1,endpoint1.z());
  gl.glVertex3f(endpoint2.x() - 2 * fthickness,endpoint2.y() + 0.1f * fScalFactor2,endpoint2.z());
  gl.glVertex3f(endpoint2.x() - 1 * fthickness,endpoint2.y() + 0.1f * fScalFactor2,endpoint2.z());
  gl.glEnd();
  gl.glPushAttrib(GL.GL_CURRENT_BIT | GL.GL_LINE_BIT);
  gl.glColor4f(1,1,1,0.45f);
  Texture TextureMask=iconTextureManager.getIconTexture(gl,EIconTextures.NAVIGATION_MASK_CURVE);
  TextureMask.enable();
  TextureMask.bind();
  TextureCoords texCoordsMask=TextureMask.getImageTexCoords();
  gl.glBegin(GL.GL_POLYGON);
  gl.glTexCoord2f(texCoordsMask.left(),texCoordsMask.top());
  gl.glVertex3f(startpoint1.x() + 2 * fthickness,startpoint1.y(),startpoint1.z());
  gl.glTexCoord2f(texCoordsMask.left(),texCoordsMask.bottom());
  gl.glVertex3f(startpoint1.x() + 1 * fthickness,startpoint1.y(),startpoint1.z());
  gl.glTexCoord2f(texCoordsMask.right(),texCoordsMask.bottom());
  gl.glVertex3f(startpoint1.x() + 1 * fthickness,startpoint1.y() + 0.1f * fScalFactor1,startpoint1.z());
  gl.glTexCoord2f(texCoordsMask.right(),texCoordsMask.top());
  gl.glVertex3f(startpoint1.x() + 2 * fthickness,startpoint1.y() + 0.1f * fScalFactor1,startpoint1.z());
  gl.glEnd();
  gl.glBegin(GL.GL_POLYGON);
  gl.glTexCoord2f(texCoordsMask.left(),texCoordsMask.top());
  gl.glVertex3f(startpoint2.x() + 2 * fthickness,startpoint2.y(),startpoint2.z());
  gl.glTexCoord2f(texCoordsMask.left(),texCoordsMask.bottom());
  gl.glVertex3f(startpoint2.x() + 1 * fthickness,startpoint2.y(),startpoint2.z());
  gl.glTexCoord2f(texCoordsMask.right(),texCoordsMask.bottom());
  gl.glVertex3f(startpoint2.x() + 1 * fthickness,startpoint2.y() - 0.1f * fScalFactor2,startpoint2.z());
  gl.glTexCoord2f(texCoordsMask.right(),texCoordsMask.top());
  gl.glVertex3f(startpoint2.x() + 2 * fthickness,startpoint2.y() - 0.1f * fScalFactor2,startpoint2.z());
  gl.glEnd();
  TextureMask.disable();
  Texture TextureMaskNeg=iconTextureManager.getIconTexture(gl,EIconTextures.NAVIGATION_MASK_CURVE_NEG);
  TextureMaskNeg.enable();
  TextureMaskNeg.bind();
  TextureCoords texCoordsMaskNeg=TextureMaskNeg.getImageTexCoords();
  gl.glBegin(GL.GL_POLYGON);
  gl.glTexCoord2f(texCoordsMaskNeg.left(),texCoordsMaskNeg.bottom());
  gl.glVertex3f(endpoint1.x() - 2 * fthickness,endpoint1.y() - 0.1f * fScalFactor1,endpoint1.z());
  gl.glTexCoord2f(texCoordsMaskNeg.right(),texCoordsMaskNeg.bottom());
  gl.glVertex3f(endpoint1.x() - 1 * fthickness,endpoint1.y() - 0.1f * fScalFactor1,endpoint1.z());
  gl.glTexCoord2f(texCoordsMaskNeg.right(),texCoordsMaskNeg.top());
  gl.glVertex3f(endpoint1.x() - 1 * fthickness,endpoint1.y(),endpoint1.z());
  gl.glTexCoord2f(texCoordsMaskNeg.left(),texCoordsMaskNeg.top());
  gl.glVertex3f(endpoint1.x() - 2 * fthickness,endpoint1.y(),endpoint1.z());
  gl.glEnd();
  gl.glBegin(GL.GL_POLYGON);
  gl.glTexCoord2f(texCoordsMaskNeg.left(),texCoordsMaskNeg.bottom());
  gl.glVertex3f(endpoint2.x() - 2 * fthickness,endpoint2.y() + 0.1f * fScalFactor2,endpoint2.z());
  gl.glTexCoord2f(texCoordsMaskNeg.right(),texCoordsMaskNeg.bottom());
  gl.glVertex3f(endpoint2.x() - 1 * fthickness,endpoint2.y() + 0.1f * fScalFactor2,endpoint2.z());
  gl.glTexCoord2f(texCoordsMaskNeg.right(),texCoordsMaskNeg.top());
  gl.glVertex3f(endpoint2.x() - 1 * fthickness,endpoint2.y(),endpoint2.z());
  gl.glTexCoord2f(texCoordsMaskNeg.left(),texCoordsMaskNeg.top());
  gl.glVertex3f(endpoint2.x() - 2 * fthickness,endpoint2.y(),endpoint2.z());
  gl.glEnd();
  TextureMaskNeg.disable();
  gl.glPopAttrib();
}

Fixed version (ground truth):
/** 
 * Render a curved (nice looking) connection line from given start point to given end point
 * @param gl
 * @param startpoint
 * @param endpoint
 */
private void renderSelectedDomain(GL gl,Vec3f startpoint1,Vec3f endpoint1,Vec3f startpoint2,Vec3f endpoint2){
  float fthickness=(endpoint1.x() - startpoint1.x()) / 4;
  float fScalFactor1, fScalFactor2;
  if (endpoint1.y() - startpoint1.y() < 0.2f)   fScalFactor1=(endpoint1.y() - startpoint1.y()) * 5f;
 else   fScalFactor1=1;
  if (startpoint2.y() - endpoint2.y() < 0.2f)   fScalFactor2=(startpoint2.y() - endpoint2.y()) * 5f;
 else   fScalFactor2=1;
  gl.glColor4f(0.5f,0.5f,0.5f,1f);
  gl.glBegin(GL.GL_QUADS);
  gl.glVertex3f(startpoint1.x(),startpoint1.y(),startpoint1.z());
  gl.glVertex3f(startpoint1.x() + 2 * fthickness,startpoint1.y(),startpoint1.z());
  gl.glVertex3f(startpoint2.x() + 2 * fthickness,startpoint2.y(),startpoint2.z());
  gl.glVertex3f(startpoint2.x(),startpoint2.y(),startpoint2.z());
  gl.glEnd();
  gl.glBegin(GL.GL_QUADS);
  gl.glVertex3f(endpoint1.x(),endpoint1.y(),endpoint1.z());
  gl.glVertex3f(endpoint1.x() - 1 * fthickness,endpoint1.y(),endpoint1.z());
  gl.glVertex3f(endpoint2.x() - 1 * fthickness,endpoint2.y(),endpoint2.z());
  gl.glVertex3f(endpoint2.x(),endpoint2.y(),endpoint2.z());
  gl.glEnd();
  gl.glBegin(GL.GL_QUADS);
  gl.glVertex3f(endpoint1.x() - 1 * fthickness,endpoint1.y() - 0.1f * fScalFactor1,endpoint1.z());
  gl.glVertex3f(endpoint1.x() - 2 * fthickness,endpoint1.y() - 0.1f * fScalFactor1,endpoint1.z());
  gl.glVertex3f(endpoint2.x() - 2 * fthickness,endpoint2.y() + 0.1f * fScalFactor2,endpoint2.z());
  gl.glVertex3f(endpoint2.x() - 1 * fthickness,endpoint2.y() + 0.1f * fScalFactor2,endpoint2.z());
  gl.glEnd();
  gl.glPushAttrib(GL.GL_CURRENT_BIT | GL.GL_LINE_BIT);
  gl.glColor4f(1,1,1,1);
  Texture TextureMask=iconTextureManager.getIconTexture(gl,EIconTextures.NAVIGATION_MASK_CURVE);
  TextureMask.enable();
  TextureMask.bind();
  TextureCoords texCoordsMask=TextureMask.getImageTexCoords();
  gl.glBegin(GL.GL_POLYGON);
  gl.glTexCoord2f(texCoordsMask.right(),texCoordsMask.top());
  gl.glVertex3f(startpoint1.x() + 2 * fthickness,startpoint1.y(),startpoint1.z());
  gl.glTexCoord2f(texCoordsMask.left(),texCoordsMask.top());
  gl.glVertex3f(startpoint1.x() + 1 * fthickness,startpoint1.y(),startpoint1.z());
  gl.glTexCoord2f(texCoordsMask.left(),texCoordsMask.bottom());
  gl.glVertex3f(startpoint1.x() + 1 * fthickness,startpoint1.y() + 0.1f * fScalFactor1,startpoint1.z());
  gl.glTexCoord2f(texCoordsMask.right(),texCoordsMask.bottom());
  gl.glVertex3f(startpoint1.x() + 2 * fthickness,startpoint1.y() + 0.1f * fScalFactor1,startpoint1.z());
  gl.glEnd();
  gl.glBegin(GL.GL_POLYGON);
  gl.glTexCoord2f(texCoordsMask.right(),texCoordsMask.top());
  gl.glVertex3f(startpoint2.x() + 2 * fthickness,startpoint2.y(),startpoint2.z());
  gl.glTexCoord2f(texCoordsMask.left(),texCoordsMask.top());
  gl.glVertex3f(startpoint2.x() + 1 * fthickness,startpoint2.y(),startpoint2.z());
  gl.glTexCoord2f(texCoordsMask.left(),texCoordsMask.bottom());
  gl.glVertex3f(startpoint2.x() + 1 * fthickness,startpoint2.y() - 0.1f * fScalFactor2,startpoint2.z());
  gl.glTexCoord2f(texCoordsMask.right(),texCoordsMask.bottom());
  gl.glVertex3f(startpoint2.x() + 2 * fthickness,startpoint2.y() - 0.1f * fScalFactor2,startpoint2.z());
  gl.glEnd();
  TextureMask.disable();
  Texture TextureMaskNeg=iconTextureManager.getIconTexture(gl,EIconTextures.NAVIGATION_MASK_CURVE_NEG);
  TextureMaskNeg.enable();
  TextureMaskNeg.bind();
  TextureCoords texCoordsMaskNeg=TextureMaskNeg.getImageTexCoords();
  gl.glBegin(GL.GL_POLYGON);
  gl.glTexCoord2f(texCoordsMaskNeg.left(),texCoordsMaskNeg.bottom());
  gl.glVertex3f(endpoint1.x() - 2 * fthickness,endpoint1.y() - 0.1f * fScalFactor1,endpoint1.z());
  gl.glTexCoord2f(texCoordsMaskNeg.right(),texCoordsMaskNeg.bottom());
  gl.glVertex3f(endpoint1.x() - 1 * fthickness,endpoint1.y() - 0.1f * fScalFactor1,endpoint1.z());
  gl.glTexCoord2f(texCoordsMaskNeg.right(),texCoordsMaskNeg.top());
  gl.glVertex3f(endpoint1.x() - 1 * fthickness,endpoint1.y(),endpoint1.z());
  gl.glTexCoord2f(texCoordsMaskNeg.left(),texCoordsMaskNeg.top());
  gl.glVertex3f(endpoint1.x() - 2 * fthickness,endpoint1.y(),endpoint1.z());
  gl.glEnd();
  gl.glBegin(GL.GL_POLYGON);
  gl.glTexCoord2f(texCoordsMaskNeg.left(),texCoordsMaskNeg.bottom());
  gl.glVertex3f(endpoint2.x() - 2 * fthickness,endpoint2.y() + 0.1f * fScalFactor2,endpoint2.z());
  gl.glTexCoord2f(texCoordsMaskNeg.right(),texCoordsMaskNeg.bottom());
  gl.glVertex3f(endpoint2.x() - 1 * fthickness,endpoint2.y() + 0.1f * fScalFactor2,endpoint2.z());
  gl.glTexCoord2f(texCoordsMaskNeg.right(),texCoordsMaskNeg.top());
  gl.glVertex3f(endpoint2.x() - 1 * fthickness,endpoint2.y(),endpoint2.z());
  gl.glTexCoord2f(texCoordsMaskNeg.left(),texCoordsMaskNeg.top());
  gl.glVertex3f(endpoint2.x() - 2 * fthickness,endpoint2.y(),endpoint2.z());
  gl.glEnd();
  TextureMaskNeg.disable();
  gl.glPopAttrib();
}