Tesselation errors for combined verticies

I am writing some code to generate filled (extruded) shapes from PostScript path info (essentially 3D strokes). I have it mostly working, but I am getting odd results
out of the tesellator. I suspect it is the combine callback code. It is not at all obvious to me what the combine method is supposed to do, exactly. My code looks like this:

public void combine(double[] coords, Object[] data, float[] weight, Object[] outData)
{
System.out.println(“Combine called!”);

double newData[] = new double[6];

  newData[0] = coords[0];
  newData[1] = coords[1];
  newData[2] = coords[2];
                   
  for ( int i=3; i<6; i++ )
  {
  	newData[i] = 0;
        for ( int j=0; j<4; j++ )
        {
         	newData[i] += weight[j] * Array.getDouble(data[j],i-3);
        }      	
  }

  outData[0] = newData;      

}

This doesn’t generate any errors, but I do get some odd tessellation results (missing bits) so it may not be correct. I didn’t find much about it on the web and much of that is obviously wrong. Any suggestions would be appreciated. TIA.

Well, it looks like I solved this myself. It wasn’t the combine method after all. I believe my implementation is correct - though I’d be happy to hear otherwise from more knowledgeable folks. It turned out that the code building the tessellation object was incorrect. That code was code that I inherited along with the original “FontDrawer” code that I based the TextRenderer3D on. I am now amazed that TextRenderer3D works as well as it does. I suspect that the font glyphs have many redundant points along the path of the glyph, especially at the beginning and end.

Its kind of striking how much incorrect code is out there. This code was wrong (and I found similar examples on the web). The code examples I found for the combine callback were also mostly wrong - including the example that is in the jogl documentation itself (in th JOGL docs under GLU_TESS_COMBINE). Good thing I have never posted any incorrect code… :wink:

I will post the resulting code back to the joglutils depot as soon as I can - my main machine is currently mothballed while my house is sheetrocked… :stuck_out_tongue:

I found one bug. Turns out that the number of points to be combined can vary. Apparently can be 2 or 4 and possibly 3, so the fix is to check the number of non-NULL members in the array passed in.

`	public void combine(double[] coords, Object[] data, float[] weight, Object[] outData)
	{
		// System.out.println("Combine called!");
		
		double newData[] = new double[6];

        newData[0] = coords[0];
        newData[1] = coords[1];
        newData[2] = coords[2];
        
        int n = 0;
        while (data[n] != null) n++;
                         
        for ( int i=3; i<6; i++ )
        {
        	newData[i] = 0;
            for ( int j=0; j<n; j++ )
            {
            	newData[i] += weight[j] * Array.getDouble(data[j],i-3);
            }      	
        }

        outData[0] = newData;      
	}