1. pragma Warnings (Off); 
  2. pragma Style_Checks (Off); 
  3.  
  4. ------------------------------------------------------------------------- 
  5.  --  GL.Geometry - GL geometry primitives 
  6.  -- 
  7.  --  Copyright (c) Rod Kay 2007 
  8.  --  AUSTRALIA 
  9.  --  Permission granted to use this software, without any warranty, 
  10.  --  for any purpose, provided this copyright note remains attached 
  11.  --  and unmodified if sources are distributed further. 
  12.  ------------------------------------------------------------------------- 
  13.  
  14.  -- with Ada.Numerics.Generic_Elementary_functions; 
  15.  -- with Ada.Text_IO; use Ada.Text_IO; 
  16.  
  17. package body GL.Geometry.VBO is 
  18.  
  19.    use GL.Buffer; 
  20.  
  21.    function  primitive_Id (Self  : in     vbo_Geometry) return GL.ObjectTypeEnm 
  22.    is 
  23.    begin 
  24.       return self.primitive_Id; 
  25.    end; 
  26.  
  27.    function  vertex_Count  (Self  : in     vbo_Geometry) return GL.geometry.vertex_Id 
  28.    is 
  29.    begin 
  30.       return vertex_Id (self.vertex_Count); 
  31.    end; 
  32.  
  33.    function  indices_Count (Self  : in     vbo_Geometry) return GL.positive_uInt 
  34.    is 
  35.    begin 
  36.       return GL.positive_uInt (self.indices_Count); 
  37.    end; 
  38.  
  39.    function  Bounds (Self  : in     vbo_Geometry) return GL.geometry.Bounds_record 
  40.    is 
  41.    begin 
  42.       return self.Bounds; 
  43.    end; 
  44.  
  45.    procedure draw (Self  : in     vbo_Geometry) 
  46.    is 
  47.    begin 
  48.       self.Vertices.enable; 
  49.       GL.vertexPointer (3, GL_DOUBLE, 0, null); 
  50.  
  51.       self.Indices.enable; 
  52.  
  53.       GL.Enable_Client_State  (gl.VERTEX_ARRAY); 
  54.  
  55.       GL.drawElements       (self.primitive_Id,  self.indices_Count, GL.UNSIGNED_INT, null); 
  56.       GL.Disable_Client_State (gl.VERTEX_ARRAY); 
  57.    end; 
  58.  
  59.    --  Modified by zheng, 2011.1.20 
  60.    function Vertices (Self  : in     vbo_Geometry) return GL.geometry.GL_Vertex_array 
  61.    is 
  62.       self_buf : aliased vbo_Geometry :=self; 
  63.    begin 
  64.       return self_buf.Vertices.get; 
  65.    end; 
  66.  
  67.    --  Modified by zheng, 2011.1.20 
  68.    function Indices (Self  : in     vbo_Geometry) return GL.geometry.vertex_Id_array 
  69.    is 
  70.       self_buf : aliased vbo_Geometry :=self; 
  71.       gl_Indices  : vertex_Id_array := self_buf.Indices.get; 
  72.    begin 
  73.       increment (gl_Indices); 
  74.       return gl_Indices; 
  75.    end; 
  76.  
  77.    procedure destroy (Self  : in out vbo_Geometry) 
  78.    is 
  79.    begin 
  80.       destroy (self.Vertices); 
  81.       destroy (self.Indices); 
  82.    end; 
  83.  
  84. end GL.Geometry.VBO;