comp.lang.ada
 help / color / mirror / Atom feed
From: jerry@jvdsys.nextjk.stuyts.nl (Jerry van Dijk)
Subject: Re: problems with GLUT
Date: 1998/11/07
Date: 1998-11-07T00:00:00+00:00	[thread overview]
Message-ID: <F21qM4.9A@jvdsys.nextjk.stuyts.nl> (raw)
In-Reply-To: 71vesd$evd$1@nyheter.chalmers.se

Knut Wannheden (d96knut@dtek.chalmers.se) wrote:

: I register the callback with glutCreateMenu(). The callback function is 
: supposed to take one argument (Integer).

The argument of glutCreateMenu is a procedure access type.
The procedure accessed takes 1 argument which is an Integer that tells
you which entry was selected.

Example:

Here I create a pop-menu to select a color:

   -----------------------
   -- window color menu --
   -----------------------

   Color_Submenu := Glut.glutCreateMenu (SelectColor'Unrestricted_Access);
   Glut.glutAddMenuEntry (Green_String, 1);
   Glut.glutAddMenuEntry (Red_String, 2);
   Glut.glutAddMenuEntry (White_String, 3);

Activate it as a submenu:

   Glut.glutAttachMenu (Glut.GLUT_RIGHT_BUTTON);

Here is the callback procedure that actually sets the color:

   -----------------------
   -- window color menu --
   -----------------------

   procedure SelectColor (Color : in Integer) is
   begin
      case Color is
         when 1 => Gl.GlColor3f (0.0, 1.0, 0.0);  -- green
         when 2 => Gl.glColor3f (1.0, 0.0, 0.0);  -- red
         when 3 => Gl.glColor3f (1.0, 1.0, 1.0);  -- white
         when others => null; -- no error handling
      end case;
      Glut.glutPostRedisplay;
   end SelectColor;

Jerry.

-- 
-- Jerry van Dijk  | email: jdijk@acm.org
-- Leiden, Holland | member Team-Ada
-- Ada & Win32: http://stad.dsl.nl/~jvandyk




      reply	other threads:[~1998-11-07  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-11-06  0:00 problems with GLUT Knut Wannheden
1998-11-07  0:00 ` Jerry van Dijk [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox