← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Anti-aliasing for the 3D-Viewer

 

Le 03/08/2014 12:00, mj a écrit :
> On 03.08.2014 10:14, jp charras wrote:
>> Le 03/08/2014 03:24, Martin Janitschke a écrit :
>>> Heyho,
>>> please feel free to test and apply the attached patch for the 3D viewer.
>>>
>>> It'll enable anti-aliasing - if the renderer supports it with up to
>>> factor 8 (beyond this there was no difference in the subtracted images).
>>> The code also deals with the possible changes to the attributes array
>>> (avoiding fixed indices).
>>>
>>> For the results see http://imgur.com/a/TgaXT .
>>>
>>> Bye,
>>> imp
>>
>> Thanks for your patch.
>>
>> However it has a potential bug in loops:
>> for( ii = 0; ii < sizeof( attrs ); ii += 2)
>> does not stop the iteration at the end of the table.
> Ah, good catch, forgot / sizeof( attrs[0] )...
> 
>> and the code expects  WX_GL_SAMPLES is the last item in attrs table,
>> which is currently true, but could be modified later (and there is no
>> comment to explain this constraint).
> No. It _is_ build to avoid depending on special positions / indices in
> that array - that's why there are 2 for loops searching for those
> elements. But it's expected to be on an even position in that array, see
> below.
> 
> The attrs array is:
> attribute-id, value for that attribute,
> another attribute-id, value for another attribute,
> ...., 0. (Or at least what I've thought it would be first).
> That's the reason for the += 2 (skipping the value of the attribute we
> checked). BUT wxwidgets made some strage exceptions for "boolean
> attributes" that don't have a value (likely copying it from opengl <
> 13...). This can lead to an exception of the 2*n + 1 rule. Added a
> comment for this and put in those attributes in a second time as padding
> (thus enforcing the tuples / attributes on even positions).
> Additionally we can change the condition to
> "ii < sizeof( attrs ) / sizeof( attrs[0] ) - 1" and save 2x one
> iteration (avoiding to check the null termination against WX_GL_...).
> New patch attached.
> 
> Bye,
> imp
> 

Committed, Thanks.

Unfortunately, my graphic card does not support anti aliasing, and I am
not able to test this enhancement.

-- 
Jean-Pierre CHARRAS


Follow ups

References