1. -- Change log: 
  2.  
  3.  -- GdM : 2005, 2006 : Get, Project also in Ada style 
  4.  
  5.  -- GdM : 29 - Jan - 2004  : added GLU.Get, (glGetdoublev) for GLU's matrices 
  6.  
  7.  -- GdM : 11 - Apr - 2002  : * adapated to the "GL .. ." and " .. .4x" - less GL 
  8.  --                    * "glu .. ." and other useless C prefixes removed 
  9.  --                    * removing of " .. .4f" - style siffixes in progress 
  10.  
  11.  -- Changed by MB for Windows 95, 980529 
  12.  -- C replaced by Stdcall 
  13.  -- 
  14.  -- OpenGL 1.1 Ada binding, package GLU 
  15.  -- 
  16.  -- W. M. Richards, NiEstu, Phoenix AZ, December 1997 
  17.  -- 
  18.  -- Converted from Brian Paul's Mesa package glu.h header file, version 2, 5. 
  19.  -- As noted below in Brian's original comments, this code is distributed 
  20.  -- under the terms of the GNU Library General Public License. 
  21.  -- 
  22.  -- Version 0.1, 21 December 1997 
  23.  -- 
  24.  -- 
  25.  -- Here are the original glu.h comments: 
  26.  -- 
  27.  -- Mesa 3 - D graphics library 
  28.  -- Version :  2.4 
  29.  -- Copyright (C) 1995 - 1997  Brian Paul 
  30.  -- 
  31.  -- This library is free software; you can redistribute it and/or 
  32.  -- modify it under the terms of the GNU Library General Public 
  33.  -- License as published by the Free Software Foundation; either 
  34.  -- version 2 of the License, or (at your option) any later version. 
  35.  -- 
  36.  -- This library is distributed in the hope that it will be useful, 
  37.  -- but WITHOUT ANY WARRANTY; without even the implied warranty of 
  38.  -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
  39.  -- Library General Public License for more details. 
  40.  -- 
  41.  -- You should have received a copy of the GNU Library General Public 
  42.  -- License along with this library; if not, write to the Free 
  43.  -- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
  44.  -- 
  45.  
  46. with GL; 
  47.  
  48. package GLU is 
  49.  
  50.    VERSION_1_1                      : constant := 1; 
  51.  
  52.    -- The GLU boolean constants 
  53.    GL_FALSE                            : constant := GL.GL_False; 
  54.    GL_TRUE                             : constant := GL.GL_True; 
  55.  
  56.    ------------------------------------------------------------------------------ 
  57.  
  58.    type Viewport_Rec is record 
  59.       X, Y :           aliased GL.Int; 
  60.       Width, Height :  aliased GL.Int; 
  61.    end record; 
  62.  
  63.    type Matrix_Float      is array (0 .. 3, 0 .. 3) of aliased GL.C_Float; 
  64.    type Matrix_Double     is array (0 .. 3, 0 .. 3) of aliased GL.Double; 
  65.  
  66.    type Viewport_Ptr      is access all Viewport_Rec; 
  67.    type Matrix_Float_Ptr  is access all Matrix_Float; 
  68.    type Matrix_Double_Ptr is access all Matrix_Double; 
  69.  
  70.    type GLUquadricObj      is private; 
  71.    type GLUtriangulatorObj is private; 
  72.    type GLUnurbsObj        is private; 
  73.  
  74.    type GLUquadricObjPtr      is access all GLUquadricObj; 
  75.    type GLUtriangulatorObjPtr is access all GLUtriangulatorObj; 
  76.    type GLUnurbsObjPtr        is access all GLUnurbsObj; 
  77.  
  78.    ------------------------------------------------------------------------------ 
  79.  
  80.    -- Error string 
  81.    type ErrorEnm is 
  82.      ( 
  83.       GL_NO_ERROR, 
  84.       GL_INVALID_ENUM, 
  85.       GL_INVALID_VALUE, 
  86.       GL_INVALID_OPERATION, 
  87.       GL_STACK_OVERFLOW, 
  88.       GL_STACK_UNDERFLOW, 
  89.       GL_OUT_OF_MEMORY, 
  90.       GLU_INVALID_ENUM, 
  91.       GLU_INVALID_VALUE, 
  92.       GLU_OUT_OF_MEMORY, 
  93.       GLU_INCOMPATIBLE_GL_VERSION 
  94.      ); 
  95.    for ErrorEnm use 
  96.      ( 
  97.       GL_NO_ERROR                                => 16#0000#, 
  98.       GL_INVALID_ENUM                            => 16#0500#, 
  99.       GL_INVALID_VALUE                           => 16#0501#, 
  100.       GL_INVALID_OPERATION                       => 16#0502#, 
  101.       GL_STACK_OVERFLOW                          => 16#0503#, 
  102.       GL_STACK_UNDERFLOW                         => 16#0504#, 
  103.       GL_OUT_OF_MEMORY                           => 16#0505#, 
  104.       GLU_INVALID_ENUM                           => 16#18A24#, 
  105.       GLU_INVALID_VALUE                          => 16#18A25#, 
  106.       GLU_OUT_OF_MEMORY                          => 16#18A26#, 
  107.       GLU_INCOMPATIBLE_GL_VERSION                => 16#18A27#  -- Mesa - specific? 
  108.      ); 
  109.    for ErrorEnm'Size use GL.enum'Size; 
  110.  
  111.    function ErrorString (errorCode : ErrorEnm) 
  112.                         return GL.ubytePtr; 
  113.  
  114.    function Error_String (errorCode : GL.ErrorEnm) 
  115.                         return GL.ubytePtr; 
  116.  
  117.    -- Scale image 
  118.    function ScaleImage (format    : GL.PixelFormatEnm; 
  119.                         widthin   : GL.Int; 
  120.                         heightin  : GL.Int; 
  121.                         typein    : GL.PixelDataTypeEnm; 
  122.                         datain    : GL.pointer; 
  123.                         widthout  : GL.Int; 
  124.                         heightout : GL.Int; 
  125.                         typeout   : GL.PixelDataTypeEnm; 
  126.                         dataout   : GL.pointer) 
  127.                        return GL.Int; 
  128.  
  129.    -- Build mipmaps 
  130.    function Build1DMipmaps (target     : GL.TargetTex1DOnlyEnm; 
  131.                             components : GL.Int; 
  132.                             width      : GL.Int; 
  133.                             format     : GL.TexPixelFormatEnm; 
  134.                             c_type     : GL.PixelDataTypeEnm; 
  135.                             data       : GL.pointer) 
  136.                            return GL.Int; 
  137.  
  138.    function Build2DMipmaps (target     : GL.TargetTex2DOnlyEnm; 
  139.                             components : GL.Int; 
  140.                             width      : GL.Int; 
  141.                             height     : GL.Int; 
  142.                             format     : GL.TexPixelFormatEnm; 
  143.                             c_type     : GL.PixelDataTypeEnm; 
  144.                             data       : GL.pointer) 
  145.                            return GL.Int; 
  146.  
  147.    -- Quadric objects 
  148.    type DrawStyleEnm is 
  149.      ( 
  150.       GLU_POINT, 
  151.       GLU_LINE, 
  152.       GLU_FILL, 
  153.       GLU_SILHOUETTE 
  154.      ); 
  155.    for DrawStyleEnm use 
  156.      ( 
  157.       GLU_POINT                                  => 16#186AA#, 
  158.       GLU_LINE                                   => 16#186AB#, 
  159.       GLU_FILL                                   => 16#186AC#, 
  160.       GLU_SILHOUETTE                             => 16#186AD# 
  161.      ); 
  162.    for DrawStyleEnm'Size use GL.enum'Size; 
  163.  
  164.    type OrientationEnm is 
  165.      ( 
  166.       GLU_OUTSIDE, 
  167.       GLU_INSIDE 
  168.      ); 
  169.    for OrientationEnm use 
  170.      ( 
  171.       GLU_OUTSIDE                                => 16#186B4#, 
  172.       GLU_INSIDE                                 => 16#186B5# 
  173.      ); 
  174.    for OrientationEnm'Size use GL.enum'Size; 
  175.  
  176.    type NormalsEnm is 
  177.      ( 
  178.       GLU_SMOOTH, 
  179.       GLU_FLAT, 
  180.       GLU_NONE 
  181.      ); 
  182.    for NormalsEnm use 
  183.      ( 
  184.       GLU_SMOOTH                                 => 16#186A0#, 
  185.       GLU_FLAT                                   => 16#186A1#, 
  186.       GLU_NONE                                   => 16#186A2# 
  187.      ); 
  188.    for NormalsEnm'Size use GL.enum'Size; 
  189.  
  190.    type CallbackEnm is 
  191.      ( 
  192.       GLU_ERROR 
  193.      ); 
  194.    for CallbackEnm use 
  195.      ( 
  196.       GLU_ERROR                                  => 16#18707# 
  197.      ); 
  198.    for CallbackEnm'Size use GL.enum'Size; 
  199.  
  200.    type QuadricCallbackFunction is access procedure (Error :  ErrorEnm); 
  201.  
  202.    function NewQuadric 
  203.      return GLUquadricObjPtr; 
  204.  
  205.    procedure DeleteQuadric (state : GLUquadricObjPtr); 
  206.  
  207.    procedure QuadricDrawStyle (quadObject : GLUquadricObjPtr; 
  208.                                drawStyle  : DrawStyleEnm); 
  209.  
  210.    procedure QuadricOrientation (quadObject  : GLUquadricObjPtr; 
  211.                                  orientation : OrientationEnm); 
  212.  
  213.    procedure QuadricNormals (quadObject : GLUquadricObjPtr; 
  214.                              normals    : NormalsEnm); 
  215.  
  216.    procedure QuadricTexture (quadObject    : GLUquadricObjPtr; 
  217.                              textureCoords : GL.GL_Boolean); 
  218.  
  219.    procedure QuadricCallback (qobj  : GLUquadricObjPtr; 
  220.                               which : CallbackEnm; 
  221.                               fn    : QuadricCallbackFunction); 
  222.  
  223.    procedure Cylinder (qobj       : GLUquadricObjPtr; 
  224.                        baseRadius : GL.Double; 
  225.                        topRadius  : GL.Double; 
  226.                        height     : GL.Double; 
  227.                        slices     : GL.Int; 
  228.                        stacks     : GL.Int); 
  229.  
  230.    procedure Sphere (qobj   : GLUquadricObjPtr; 
  231.                      radius : GL.Double; 
  232.                      slices : GL.Int; 
  233.                      stacks : GL.Int); 
  234.  
  235.    procedure Disk (qobj        : GLUquadricObjPtr; 
  236.                    innerRadius : GL.Double; 
  237.                    outerRadius : GL.Double; 
  238.                    slices      : GL.Int; 
  239.                    loops       : GL.Int); 
  240.  
  241.    procedure PartialDisk (qobj        : GLUquadricObjPtr; 
  242.                           innerRadius : GL.Double; 
  243.                           outerRadius : GL.Double; 
  244.                           slices      : GL.Int; 
  245.                           loops       : GL.Int; 
  246.                           startAngle  : GL.Double; 
  247.                           sweepAngle  : GL.Double); 
  248.  
  249.    -- Non - uniform rational B - splines (NURBS) 
  250.    type NurbsPropertyEnm is 
  251.      ( 
  252.       GLU_AUTO_LOAD_MATRIX, 
  253.       GLU_CULLING, 
  254.       GLU_PARAMETRIC_TOLERANCE, 
  255.       GLU_SAMPLING_TOLERANCE, 
  256.       GLU_DISPLAY_MODE, 
  257.       GLU_SAMPLING_METHOD, 
  258.       GLU_U_STEP, 
  259.       GLU_V_STEP 
  260.      ); 
  261.    for NurbsPropertyEnm use 
  262.      ( 
  263.       GLU_AUTO_LOAD_MATRIX                       => 16#18768#, 
  264.       GLU_CULLING                                => 16#18769#, 
  265.       GLU_PARAMETRIC_TOLERANCE                   => 16#1876A#, 
  266.       GLU_SAMPLING_TOLERANCE                     => 16#1876B#, 
  267.       GLU_DISPLAY_MODE                           => 16#1876C#, 
  268.       GLU_SAMPLING_METHOD                        => 16#1876D#, 
  269.       GLU_U_STEP                                 => 16#1876E#, 
  270.       GLU_V_STEP                                 => 16#1876F# 
  271.      ); 
  272.    for NurbsPropertyEnm'Size use GL.enum'Size; 
  273.  
  274.    type NurbsDisplayModeEnm is 
  275.      ( 
  276.       GLU_FILL, 
  277.       GLU_OUTLINE_POLYGON, 
  278.       GLU_OUTLINE_PATCH 
  279.      ); 
  280.    for NurbsDisplayModeEnm use 
  281.      ( 
  282.       GLU_FILL                                   => 16#186AC#, 
  283.       GLU_OUTLINE_POLYGON                        => 16#18790#, 
  284.       GLU_OUTLINE_PATCH                          => 16#18791# 
  285.      ); 
  286.    for NurbsDisplayModeEnm'Size use GL.enum'Size; 
  287.  
  288.    -- NURBS property values 
  289.    GLU_PATH_LENGTH                      : constant := 16#18777#; 
  290.    GLU_PARAMETRIC_ERROR                 : constant := 16#18778#; 
  291.    GLU_DOMAIN_DISTANCE                  : constant := 16#18779#; 
  292.  
  293.    type NurbsErrorEnm is 
  294.      ( 
  295.       GLU_NURBS_ERROR1,                                       -- spline order un - supported , 
  296.       GLU_NURBS_ERROR2,                                       -- too few knots , 
  297.       GLU_NURBS_ERROR3,                                       -- valid knot range is empty , 
  298.       GLU_NURBS_ERROR4,                                       -- decreasing knot sequence , 
  299.       GLU_NURBS_ERROR5,                                       -- knot multiplicity > spline order , 
  300.       GLU_NURBS_ERROR6,                                       -- endcurve () must follow bgncurve () , 
  301.       GLU_NURBS_ERROR7,                                       -- bgncurve () must precede endcurve () , 
  302.       GLU_NURBS_ERROR8,                                       -- ctrlarray or knot vector is NULL , 
  303.       GLU_NURBS_ERROR9,                                       -- can't draw pwlcurves , 
  304.       GLU_NURBS_ERROR10,                                      -- missing gluNurbsCurve () , 
  305.       GLU_NURBS_ERROR11,                                      -- missing gluNurbsSurface () , 
  306.       GLU_NURBS_ERROR12,                                      -- endtrim () must precede endsurface () , 
  307.       GLU_NURBS_ERROR13,                                      -- bgnsurface () must precede endsurface () , 
  308.       GLU_NURBS_ERROR14,                                      -- curve of improper type passed as trim curve , 
  309.       GLU_NURBS_ERROR15,                                      -- bgnsurface () must precede bgntrim () , 
  310.       GLU_NURBS_ERROR16,                                      -- endtrim () must follow bgntrim () , 
  311.       GLU_NURBS_ERROR17,                                      -- bgntrim () must precede endtrim (), 
  312.       GLU_NURBS_ERROR18,                                      -- invalid or missing trim curve, 
  313.       GLU_NURBS_ERROR19,                                      -- bgntrim () must precede pwlcurve () , 
  314.       GLU_NURBS_ERROR20,                                      -- pwlcurve referenced twice, 
  315.       GLU_NURBS_ERROR21,                                      -- pwlcurve and nurbscurve mixed , 
  316.       GLU_NURBS_ERROR22,                                      -- improper usage of trim data type , 
  317.       GLU_NURBS_ERROR23,                                      -- nurbscurve referenced twice , 
  318.       GLU_NURBS_ERROR24,                                      -- nurbscurve and pwlcurve mixed , 
  319.       GLU_NURBS_ERROR25,                                      -- nurbssurface referenced twice , 
  320.       GLU_NURBS_ERROR26,                                      -- invalid property , 
  321.       GLU_NURBS_ERROR27,                                      -- endsurface () must follow bgnsurface () , 
  322.       GLU_NURBS_ERROR28,                                      -- intersecting or misoriented trim curves , 
  323.       GLU_NURBS_ERROR29,                                      -- intersecting trim curves , 
  324.       GLU_NURBS_ERROR30,                                      -- UNUSED , 
  325.       GLU_NURBS_ERROR31,                                      -- unconnected trim curves , 
  326.       GLU_NURBS_ERROR32,                                      -- unknown knot error , 
  327.       GLU_NURBS_ERROR33,                                      -- negative vertex count encountered , 
  328.       GLU_NURBS_ERROR34,                                      -- negative byte - stride , 
  329.       GLU_NURBS_ERROR35,                                      -- unknown type descriptor , 
  330.       GLU_NURBS_ERROR36,                                      -- null control point reference , 
  331.       GLU_NURBS_ERROR37                                       -- duplicate point on pwlcurve 
  332.      ); 
  333.    for NurbsErrorEnm use 
  334.      ( 
  335.       GLU_NURBS_ERROR1                           => 16#1879B#, 
  336.       GLU_NURBS_ERROR2                           => 16#1879C#, 
  337.       GLU_NURBS_ERROR3                           => 16#1879D#, 
  338.       GLU_NURBS_ERROR4                           => 16#1879E#, 
  339.       GLU_NURBS_ERROR5                           => 16#1879F#, 
  340.       GLU_NURBS_ERROR6                           => 16#187A0#, 
  341.       GLU_NURBS_ERROR7                           => 16#187A1#, 
  342.       GLU_NURBS_ERROR8                           => 16#187A2#, 
  343.       GLU_NURBS_ERROR9                           => 16#187A3#, 
  344.       GLU_NURBS_ERROR10                          => 16#187A4#, 
  345.       GLU_NURBS_ERROR11                          => 16#187A5#, 
  346.       GLU_NURBS_ERROR12                          => 16#187A6#, 
  347.       GLU_NURBS_ERROR13                          => 16#187A7#, 
  348.       GLU_NURBS_ERROR14                          => 16#187A8#, 
  349.       GLU_NURBS_ERROR15                          => 16#187A9#, 
  350.       GLU_NURBS_ERROR16                          => 16#187AA#, 
  351.       GLU_NURBS_ERROR17                          => 16#187AB#, 
  352.       GLU_NURBS_ERROR18                          => 16#187AC#, 
  353.       GLU_NURBS_ERROR19                          => 16#187AD#, 
  354.       GLU_NURBS_ERROR20                          => 16#187AE#, 
  355.       GLU_NURBS_ERROR21                          => 16#187AF#, 
  356.       GLU_NURBS_ERROR22                          => 16#187B0#, 
  357.       GLU_NURBS_ERROR23                          => 16#187B1#, 
  358.       GLU_NURBS_ERROR24                          => 16#187B2#, 
  359.       GLU_NURBS_ERROR25                          => 16#187B3#, 
  360.       GLU_NURBS_ERROR26                          => 16#187B4#, 
  361.       GLU_NURBS_ERROR27                          => 16#187B5#, 
  362.       GLU_NURBS_ERROR28                          => 16#187B6#, 
  363.       GLU_NURBS_ERROR29                          => 16#187B7#, 
  364.       GLU_NURBS_ERROR30                          => 16#187B8#, 
  365.       GLU_NURBS_ERROR31                          => 16#187B9#, 
  366.       GLU_NURBS_ERROR32                          => 16#187BA#, 
  367.       GLU_NURBS_ERROR33                          => 16#187BB#, 
  368.       GLU_NURBS_ERROR34                          => 16#187BC#, 
  369.       GLU_NURBS_ERROR35                          => 16#187BD#, 
  370.       GLU_NURBS_ERROR36                          => 16#187BE#, 
  371.       GLU_NURBS_ERROR37                          => 16#187BF# 
  372.      ); 
  373.    for NurbsErrorEnm'Size use GL.enum'Size; 
  374.  
  375.    type PwlCurveTypeEnm is 
  376.      ( 
  377.       GLU_MAP1_TRIM_2, 
  378.       GLU_MAP1_TRIM_3 
  379.      ); 
  380.    for PwlCurveTypeEnm use 
  381.      ( 
  382.       GLU_MAP1_TRIM_2                            => 16#18772#, 
  383.       GLU_MAP1_TRIM_3                            => 16#18773# 
  384.      ); 
  385.    for PwlCurveTypeEnm'Size use GL.enum'Size; 
  386.  
  387.    type NurbsCallbackFunction is access procedure (Error :  NurbsErrorEnm); 
  388.  
  389.    function NewNurbsRenderer 
  390.      return GLUnurbsObjPtr; 
  391.  
  392.    procedure DeleteNurbsRenderer (nobj : GLUnurbsObjPtr); 
  393.  
  394.    procedure LoadSamplingMatrices (nobj        : GLUnurbsObjPtr; 
  395.                                    modelMatrix : Matrix_Float_Ptr; 
  396.                                    projMatrix  : Matrix_Float_Ptr; 
  397.                                    viewport    : Viewport_Ptr); 
  398.  
  399.    procedure NurbsProperty (nobj     : GLUnurbsObjPtr; 
  400.                             property : NurbsPropertyEnm; 
  401.                             value    : GL.C_Float); 
  402.  
  403.    procedure GetNurbsProperty (nobj     : GLUnurbsObjPtr; 
  404.                                property : NurbsPropertyEnm; 
  405.                                value    : GL.floatPtr); 
  406.  
  407.    procedure BeginCurve (nobj : GLUnurbsObjPtr); 
  408.  
  409.    procedure EndCurve (nobj : GLUnurbsObjPtr); 
  410.  
  411.    procedure NurbsCurve (nobj     : GLUnurbsObjPtr; 
  412.                          nknots   : GL.Int; 
  413.                          knot     : GL.floatPtr; 
  414.                          stride   : GL.Int; 
  415.                          ctlarray : GL.floatPtr; 
  416.                          order    : GL.Int; 
  417.                          c_type   : GL.Map1TargetEnm); 
  418.  
  419.    procedure BeginSurface (nobj : GLUnurbsObjPtr); 
  420.  
  421.    procedure EndSurface (nobj : GLUnurbsObjPtr); 
  422.  
  423.    procedure NurbsSurface (nobj        : GLUnurbsObjPtr; 
  424.                            sknot_count : GL.Int; 
  425.                            sknot       : GL.floatPtr; 
  426.                            tknot_count : GL.Int; 
  427.                            tknot       : GL.floatPtr; 
  428.                            s_stride    : GL.Int; 
  429.                            t_stride    : GL.Int; 
  430.                            ctlarray    : GL.floatPtr; 
  431.                            sorder      : GL.Int; 
  432.                            torder      : GL.Int; 
  433.                            c_type      : GL.Map2TargetEnm); 
  434.  
  435.    procedure BeginTrim (nobj : GLUnurbsObjPtr); 
  436.  
  437.    procedure EndTrim (nobj : GLUnurbsObjPtr); 
  438.  
  439.    procedure PwlCurve (nobj    : GLUnurbsObjPtr; 
  440.                        count   : GL.Int; 
  441.                        c_array : GL.floatPtr; 
  442.                        stride  : GL.Int; 
  443.                        c_type  : PwlCurveTypeEnm); 
  444.  
  445.    procedure NurbsCallback (nobj  : GLUnurbsObjPtr; 
  446.                             which : CallbackEnm; 
  447.                             fn    : NurbsCallbackFunction); 
  448.  
  449.    -- Polygon tesselation 
  450.    type TessCallbackEnm is 
  451.      ( 
  452.       GLU_BEGIN, 
  453.       GLU_VERTEX, 
  454.       GLU_END, 
  455.       GLU_ERROR, 
  456.       GLU_EDGE_FLAG 
  457.      ); 
  458.    for TessCallbackEnm use 
  459.      ( 
  460.       GLU_BEGIN                                  => 16#18704#,  -- Note : some implementations use "GLU_TESS_ .. ." 
  461.       GLU_VERTEX                                 => 16#18705#, 
  462.       GLU_END                                    => 16#18706#, 
  463.       GLU_ERROR                                  => 16#18707#, 
  464.       GLU_EDGE_FLAG                              => 16#18708# 
  465.      ); 
  466.    for TessCallbackEnm'Size use GL.enum'Size; 
  467.  
  468.    type TessBeginEnm is 
  469.      ( 
  470.       GL_LINE_LOOP, 
  471.       GL_TRIANGLES, 
  472.       GL_TRIANGLE_STRIP, 
  473.       GL_TRIANGLE_FAN 
  474.      ); 
  475.    for TessBeginEnm use 
  476.      ( 
  477.       GL_LINE_LOOP                               => 16#0002#, 
  478.       GL_TRIANGLES                               => 16#0004#, 
  479.       GL_TRIANGLE_STRIP                          => 16#0005#, 
  480.       GL_TRIANGLE_FAN                            => 16#0006# 
  481.      ); 
  482.    for TessBeginEnm'Size use GL.enum'Size; 
  483.    type TessBeginCallbackFunction is access procedure (ObjType :  TessBeginEnm); 
  484.  
  485.    type TessVertexCallbackFunction is access procedure (VertexData :  GL.pointer); 
  486.  
  487.    type TessEndCallbackFunction is access procedure; 
  488.  
  489.    type TessErrorEnm is 
  490.      ( 
  491.       GLU_TESS_ERROR1,                                        -- missing gluEndPolygon , 
  492.       GLU_TESS_ERROR2,                                        -- missing gluBeginPolygon , 
  493.       GLU_TESS_ERROR3,                                        -- misoriented contour , 
  494.       GLU_TESS_ERROR4,                                        -- vertex/edge intersection , 
  495.       GLU_TESS_ERROR5,                                        -- misoriented or self - intersecting loops , 
  496.       GLU_TESS_ERROR6,                                        -- coincident vertices , 
  497.       GLU_TESS_ERROR7,                                        -- all vertices collinear , 
  498.       GLU_TESS_ERROR8,                                        -- intersecting edges , 
  499.       GLU_TESS_ERROR9                                         -- not coplanar contours 
  500.      ); 
  501.    for TessErrorEnm use 
  502.      ( 
  503.       GLU_TESS_ERROR1                            => 16#18737#, 
  504.       GLU_TESS_ERROR2                            => 16#18738#, 
  505.       GLU_TESS_ERROR3                            => 16#18739#, 
  506.       GLU_TESS_ERROR4                            => 16#1873A#, 
  507.       GLU_TESS_ERROR5                            => 16#1873B#, 
  508.       GLU_TESS_ERROR6                            => 16#1873C#, 
  509.       GLU_TESS_ERROR7                            => 16#1873D#, 
  510.       GLU_TESS_ERROR8                            => 16#1873E#, 
  511.       GLU_TESS_ERROR9                            => 16#1873F# 
  512.      ); 
  513.    for TessErrorEnm'Size use GL.enum'Size; 
  514.    type TessErrorCallbackFunction is access procedure (Error :  TessErrorEnm); 
  515.  
  516.    type TessEdgeFlagCallbackFunction is access procedure (Flag :  GL.GL_Boolean); 
  517.  
  518.    type ContourTypeEnm is 
  519.      ( 
  520.       GLU_CW, 
  521.       GLU_CCW, 
  522.       GLU_INTERIOR, 
  523.       GLU_EXTERIOR, 
  524.       GLU_UNKNOWN 
  525.      ); 
  526.    for ContourTypeEnm use 
  527.      ( 
  528.       GLU_CW                                     => 16#18718#, 
  529.       GLU_CCW                                    => 16#18719#, 
  530.       GLU_INTERIOR                               => 16#1871A#, 
  531.       GLU_EXTERIOR                               => 16#1871B#, 
  532.       GLU_UNKNOWN                                => 16#1871C# 
  533.      ); 
  534.    for ContourTypeEnm'Size use GL.enum'Size; 
  535.  
  536.    function NewTess 
  537.      return GLUtriangulatorObjPtr; 
  538.  
  539.    procedure TessCallback (tobj  : GLUtriangulatorObjPtr; 
  540.                            which : TessCallbackEnm; 
  541.                            fn    : TessBeginCallbackFunction); 
  542.    procedure TessCallback (tobj  : GLUtriangulatorObjPtr; 
  543.                            which : TessCallbackEnm; 
  544.                            fn    : TessVertexCallbackFunction); 
  545.    procedure TessCallback (tobj  : GLUtriangulatorObjPtr; 
  546.                            which : TessCallbackEnm; 
  547.                            fn    : TessEndCallbackFunction); 
  548.    procedure TessCallback (tobj  : GLUtriangulatorObjPtr; 
  549.                            which : TessCallbackEnm; 
  550.                            fn    : TessErrorCallbackFunction); 
  551.    procedure TessCallback (tobj  : GLUtriangulatorObjPtr; 
  552.                            which : TessCallbackEnm; 
  553.                            fn    : TessEdgeFlagCallbackFunction); 
  554.  
  555.    procedure DeleteTess (tobj : GLUtriangulatorObjPtr); 
  556.  
  557.    procedure BeginPolygon (tobj : GLUtriangulatorObjPtr); 
  558.  
  559.    procedure EndPolygon (tobj : GLUtriangulatorObjPtr); 
  560.  
  561.    procedure NextContour (tobj   : GLUtriangulatorObjPtr; 
  562.                           c_type : ContourTypeEnm); 
  563.  
  564.    procedure TessVertex (tobj : GLUtriangulatorObjPtr; 
  565.                          v    : GL.doublePtr; 
  566.                          data : GL.pointer); 
  567.  
  568.    -- GLU strings 
  569.    type StringEnm is 
  570.      ( 
  571.       GLU_VERSION, 
  572.       GLU_EXTENSIONS 
  573.      ); 
  574.    for StringEnm use 
  575.      ( 
  576.       GLU_VERSION                                => 16#189C0#, 
  577.       GLU_EXTENSIONS                             => 16#189C1# 
  578.      ); 
  579.    for StringEnm'Size use GL.enum'Size; 
  580.  
  581.    function GetString (name : StringEnm) 
  582.                       return GL.ubytePtr; 
  583.  
  584.    -- Projections 
  585.    procedure LookAt (eyex    : GL.Double; 
  586.                      eyey    : GL.Double; 
  587.                      eyez    : GL.Double; 
  588.                      centerx : GL.Double; 
  589.                      centery : GL.Double; 
  590.                      centerz : GL.Double; 
  591.                      upx     : GL.Double; 
  592.                      upy     : GL.Double; 
  593.                      upz     : GL.Double); 
  594.  
  595.    procedure Ortho2D (left   : GL.Double; 
  596.                       right  : GL.Double; 
  597.                       bottom : GL.Double; 
  598.                       top    : GL.Double); 
  599.  
  600.    procedure Perspective (fovy   : GL.Double; 
  601.                           aspect : GL.Double; 
  602.                           zNear  : GL.Double; 
  603.                           zFar   : GL.Double); 
  604.  
  605.    procedure PickMatrix (x        : GL.Double; 
  606.                          y        : GL.Double; 
  607.                          width    : GL.Double; 
  608.                          height   : GL.Double; 
  609.                          viewport : Viewport_Ptr); 
  610.  
  611.    function Project (objx        : GL.Double; 
  612.                      objy        : GL.Double; 
  613.                      objz        : GL.Double; 
  614.                      modelMatrix : Matrix_Double_Ptr; 
  615.                      projMatrix  : Matrix_Double_Ptr; 
  616.                      viewport    : Viewport_Ptr; 
  617.                      winx        : GL.doublePtr; 
  618.                      winy        : GL.doublePtr; 
  619.                      winz        : GL.doublePtr) 
  620.                     return GL.Int; 
  621.    pragma Import (Stdcall, Project, "gluProject"); 
  622.  
  623.    -- Project, Ada style 
  624.  
  625.    procedure Project (objx        : GL.Double; 
  626.                       objy        : GL.Double; 
  627.                       objz        : GL.Double; 
  628.                       modelMatrix : Matrix_Double; 
  629.                       projMatrix  : Matrix_Double; 
  630.                       viewport    : Viewport_Rec; 
  631.                       winx        : out GL.Double; 
  632.                       winy        : out GL.Double; 
  633.                       winz        : out GL.Double; 
  634.                       result      : out Boolean); 
  635.  
  636.    function UnProject (winx        : GL.Double; 
  637.                        winy        : GL.Double; 
  638.                        winz        : GL.Double; 
  639.                        modelMatrix : Matrix_Double_Ptr; 
  640.                        projMatrix  : Matrix_Double_Ptr; 
  641.                        viewport    : Viewport_Ptr; 
  642.                        objx        : GL.doublePtr; 
  643.                        objy        : GL.doublePtr; 
  644.                        objz        : GL.doublePtr) 
  645.                       return GL.Int; 
  646.  
  647.    -- GLU.Get's 
  648.  
  649.    procedure Get (pname  : GL.ParameterNameEnm; 
  650.                   params : Matrix_Double_Ptr); 
  651.  
  652.    procedure Get (pname  : GL.ParameterNameEnm; 
  653.                   params : out Matrix_Double); 
  654.  
  655.    procedure Get (pname  : GL.ParameterNameEnm; 
  656.                   params : Viewport_Ptr); 
  657.  
  658.    procedure Get (params : out Viewport_Rec); 
  659.  
  660.    ------------------------------------------------------------------------------ 
  661.  
  662. private 
  663.  
  664.    type GLUquadricObj      is record null; end record; 
  665.    type GLUtriangulatorObj is record null; end record; 
  666.    type GLUnurbsObj        is record null; end record; 
  667.  
  668.    pragma Import (Stdcall, LookAt, "gluLookAt"); 
  669.    pragma Import (Stdcall, Ortho2D, "gluOrtho2D"); 
  670.    pragma Import (Stdcall, Perspective, "gluPerspective"); 
  671.    pragma Import (Stdcall, PickMatrix, "gluPickMatrix"); 
  672.    -- pragma Import (Stdcall, Project, "gluProject"); 
  673.    pragma Import (Stdcall, UnProject, "gluUnProject"); 
  674.  
  675.    function ErrorString_1 (errorCode : ErrorEnm)  return GL.ubytePtr; 
  676.    function ErrorString   (errorCode : ErrorEnm)  return GL.ubytePtr renames ErrorString_1; 
  677.    pragma Import (Stdcall, ErrorString_1, "gluErrorString"); 
  678.  
  679.    function ErrorString_2 (errorCode : GL.ErrorEnm) return GL.ubytePtr; 
  680.    function Error_String   (errorCode : GL.ErrorEnm) return GL.ubytePtr renames ErrorString_2; 
  681.    pragma Import (Stdcall, ErrorString_2, "gluErrorString"); 
  682.  
  683.    pragma Import (Stdcall, ScaleImage, "gluScaleImage"); 
  684.    pragma Import (Stdcall, Build1DMipmaps, "gluBuild1DMipmaps"); 
  685.    pragma Import (Stdcall, Build2DMipmaps, "gluBuild2DMipmaps"); 
  686.    pragma Import (Stdcall, NewQuadric, "gluNewQuadric"); 
  687.    pragma Import (Stdcall, DeleteQuadric, "gluDeleteQuadric"); 
  688.    pragma Import (Stdcall, QuadricDrawStyle, "gluQuadricDrawStyle"); 
  689.    pragma Import (Stdcall, QuadricOrientation, "gluQuadricOrientation"); 
  690.    pragma Import (Stdcall, QuadricNormals, "gluQuadricNormals"); 
  691.    pragma Import (Stdcall, QuadricTexture, "gluQuadricTexture"); 
  692.    pragma Import (Stdcall, QuadricCallback, "gluQuadricCallback"); 
  693.    pragma Import (Stdcall, Cylinder, "gluCylinder"); 
  694.    pragma Import (Stdcall, Sphere, "gluSphere"); 
  695.    pragma Import (Stdcall, Disk, "gluDisk"); 
  696.    pragma Import (Stdcall, PartialDisk, "gluPartialDisk"); 
  697.    pragma Import (Stdcall, NewNurbsRenderer, "gluNewNurbsRenderer"); 
  698.    pragma Import (Stdcall, DeleteNurbsRenderer, "gluDeleteNurbsRenderer"); 
  699.    pragma Import (Stdcall, LoadSamplingMatrices, "gluLoadSamplingMatrices"); 
  700.    pragma Import (Stdcall, NurbsProperty, "gluNurbsProperty"); 
  701.    pragma Import (Stdcall, GetNurbsProperty, "gluGetNurbsProperty"); 
  702.    pragma Import (Stdcall, BeginCurve, "gluBeginCurve"); 
  703.    pragma Import (Stdcall, EndCurve, "gluEndCurve"); 
  704.    pragma Import (Stdcall, NurbsCurve, "gluNurbsCurve"); 
  705.    pragma Import (Stdcall, BeginSurface, "gluBeginSurface"); 
  706.    pragma Import (Stdcall, EndSurface, "gluEndSurface"); 
  707.    pragma Import (Stdcall, NurbsSurface, "gluNurbsSurface"); 
  708.    pragma Import (Stdcall, BeginTrim, "gluBeginTrim"); 
  709.    pragma Import (Stdcall, EndTrim, "gluEndTrim"); 
  710.    pragma Import (Stdcall, PwlCurve, "gluPwlCurve"); 
  711.    pragma Import (Stdcall, NurbsCallback, "gluNurbsCallback"); 
  712.    pragma Import (Stdcall, NewTess, "gluNewTess"); 
  713.    pragma Import (Stdcall, TessCallback, "gluTessCallback"); 
  714.    pragma Import (Stdcall, DeleteTess, "gluDeleteTess"); 
  715.    pragma Import (Stdcall, BeginPolygon, "gluBeginPolygon"); 
  716.    pragma Import (Stdcall, EndPolygon, "gluEndPolygon"); 
  717.    pragma Import (Stdcall, NextContour, "gluNextContour"); 
  718.    pragma Import (Stdcall, TessVertex, "gluTessVertex"); 
  719.    pragma Import (Stdcall, GetString, "gluGetString"); 
  720.  
  721.    -- GL procedures for GLU types: 
  722.  
  723.    -- Wrappers for Get (doubleMatrix) 
  724.    procedure GetDoublev (pname  : GL.ParameterNameEnm; 
  725.                          params : Matrix_Double_Ptr); 
  726.    procedure Get (pname  : GL.ParameterNameEnm; 
  727.                   params : Matrix_Double_Ptr) renames GetDoublev; 
  728.    pragma Import (Stdcall, GetDoublev, "glGetDoublev"); 
  729.  
  730.    -- Wrappers for Get (viewPortRec) 
  731.  
  732.    procedure GetIntegerv (pname  : GL.ParameterNameEnm; 
  733.                           params : Viewport_Ptr); 
  734.    procedure Get (pname  : GL.ParameterNameEnm; 
  735.                   params : Viewport_Ptr) renames GetIntegerv; 
  736.    pragma Import (Stdcall, GetIntegerv, "glGetIntegerv"); 
  737.  
  738. end GLU;