public override void SetPointParameters( float size, bool attenuationEnabled, float constant, float linear, float quadratic, float minSize, float maxSize )
{
GLESConfig.GlCheckError( this );
if ( attenuationEnabled &&
_rsCapabilities.HasCapability( Capabilities.PointExtendedParameters ) )
{
// Point size is still calculated in pixels even when attenuation is
// enabled, which is pretty awkward, since you typically want a viewport
// independent size if you're looking for attenuation.
// So, scale the point size up by viewport size (this is equivalent to
// what D3D does as standard)
Real adjSize = size * activeViewport.ActualHeight;
Real adjMinSize = minSize * activeViewport.ActualHeight;
Real adjMaxSize = 0;
if ( maxSize == 0 )
adjMaxSize = _rsCapabilities.MaxPointSize;
else
adjMaxSize = maxSize * activeViewport.ActualHeight;
OpenGL.PointSize( adjSize );
// XXX: why do I need this for results to be consistent with D3D?
// Equations are supposedly the same once you factor in vp height
Real correction = 0.005;
//scaling required
float[] val = new float[]{constant,linear * correction,
quadratic * correction,1};
OpenGL.PointParameter( All.PointDistanceAttenuation, val );
GLESConfig.GlCheckError( this );
OpenGL.PointParameter( All.PointSizeMin, adjMinSize );
GLESConfig.GlCheckError( this );
OpenGL.PointParameter( All.PointSizeMax, adjMaxSize );
GLESConfig.GlCheckError( this );
}
else
{
// no scaling required
// GL has no disabled flag for this so just set to constant
OpenGL.PointSize( size );
GLESConfig.GlCheckError( this );
if ( _rsCapabilities.HasCapability( Capabilities.PointExtendedParameters ) )
{
float[] val = new float[] { 1, 0, 0, 1 };
OpenGL.PointParameter( All.PointDistanceAttenuation, val );
GLESConfig.GlCheckError( this );
OpenGL.PointParameter( All.PointSizeMin, minSize );
GLESConfig.GlCheckError( this );
if ( maxSize == 0.0f )
{
maxSize = _rsCapabilities.MaxPointSize;
}
OpenGL.PointParameter( All.PointSizeMax, maxSize );
GLESConfig.GlCheckError( this );
}
}
}
/// <summary>