lace_opengl_0.1.0_672a6415/source/lean/shader/opengl-attribute.ads

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
with
     GL,
     system.storage_Elements;

package openGL.Attribute
--
--  Models an openGL shader attribute.
--
is
   type Item  is tagged private;
   type View  is access all Item'Class;
   type Views is array (Positive range <>) of View;

   type data_Kind is (GL_BYTE,  GL_UNSIGNED_BYTE,
                      GL_SHORT, GL_UNSIGNED_SHORT,
                      GL_INT,   GL_UNSIGNED_INT,
                      GL_FLOAT, GL_FIXED);
   ---------
   --- Forge
   --

   procedure define  (Self : in out Item);
   procedure destroy (Self : in out Item);

   package Forge
   is
      use system.storage_Elements;

      function  to_Attribute (Name        : in String;
                              gl_Location : in gl.GLuint;
                              Size        : in gl.GLint;
                              data_Kind   : in Attribute.data_Kind;
                              Stride      : in Natural;
                              Offset      : in storage_Offset;
                              Normalized  : in Boolean) return Item;

      function new_Attribute (Name        : in String;
                              gl_Location : in gl.GLuint;
                              Size        : in gl.GLint;
                              data_Kind   : in Attribute.data_Kind;
                              Stride      : in Natural;
                              Offset      : in storage_Offset;
                              Normalized  : in Boolean) return View;
   end Forge;


   --------------
   --- Attributes
   --

   function Name        (Self : in Item'Class) return String;
   function gl_Location (Self : in Item'Class) return gl.GLuint;


   --------------
   --- Operations
   --

   procedure enable (Self : in Item);



private

   type Item is tagged
      record
         Name          : access String;
         Location      :        gl.GLuint;
         Size          :        gl.GLint;
         data_Kind     :        Attribute.data_Kind;
         vertex_Stride :        gl.GLint;
         Offset        :        system.storage_Elements.storage_Offset;
         Normalized    :        gl.GLboolean;
      end record;

   for data_Kind use (GL_BYTE           => 16#1400#,
                      GL_UNSIGNED_BYTE  => 16#1401#,
                      GL_SHORT          => 16#1402#,
                      GL_UNSIGNED_SHORT => 16#1403#,
                      GL_INT            => 16#1404#,
                      GL_UNSIGNED_INT   => 16#1405#,
                      GL_FLOAT          => 16#1406#,
                      GL_FIXED          => 16#140c#);

end openGL.Attribute;