unit TruForm;

interface

uses Windows, SysUtils, Math3D, GL, GLu, GLext, WGLext, GLtools;

const
  NORMAL_MODE_LINEAR    = GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI;
  NORMAL_MODE_QUADRATIC = GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI;
  VERTEX_MODE_LINEAR    = GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI;
  VERTEX_MODE_CUBIC     = GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI;

type
  TTruForm = class
  protected
    procedure FTessLevel(level: cardinal);
    function FGetTessLevel: cardinal;
    procedure FNormalMode(mode: cardinal);
    procedure FVertexMode(mode: cardinal);
  public
    constructor Create;
    destructor Destroy; override;
    procedure Enable;
    procedure Disable;
    property TessLevel: cardinal read FGetTessLevel write FTessLevel;
    property NormalMode: cardinal write FNormalMode;
    property VertexMode: cardinal write FVertexMode;
  end;

implementation

constructor TTruForm.Create;
begin
  if not Load_GL_ATI_pn_triangles then
    raise Exception.Create('GL_ATI_pn_triangles required!');

  inherited Create;
end;

destructor TTruForm.Destroy;
begin
  Disable;

  inherited Destroy;
end;

procedure TTruForm.Enable;
begin
  glEnable(GL_PN_TRIANGLES_ATI);
end;

procedure TTruForm.Disable;
begin
  glDisable(GL_PN_TRIANGLES_ATI);
end;

procedure TTruForm.FTessLevel;
begin
  glPNTrianglesiATI(GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI, level);
end;

function TTruForm.FGetTessLevel;
begin
  glGetIntegerv(GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI, @result);
end;

procedure TTruForm.FNormalMode;
begin
  glPNTrianglesiATI(GL_PN_TRIANGLES_NORMAL_MODE_ATI, mode);
end;

procedure TTruForm.FVertexMode;
begin
  glPNTrianglesiATI(GL_PN_TRIANGLES_POINT_MODE_ATI, mode);
end;

end.
