From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7547564584b3c77a X-Google-Attributes: gid103376,public From: Rolf Wester Subject: Re: Problems with GLUT on NT and "deeper accessibility" Date: 1998/10/30 Message-ID: <3639E95B.3CD1F79D@ilt.fhg.de>#1/1 X-Deja-AN: 406738319 Content-Transfer-Encoding: 7bit References: <3639682C.AA824493@ilt.fhg.de> Content-Type: text/plain; charset=us-ascii Organization: Fraunhofer Institut Lasertechnik Mime-Version: 1.0 Reply-To: WESTER@ilt.fhg.de Newsgroups: comp.lang.ada Date: 1998-10-30T00:00:00+00:00 List-Id: Thanks for the answer. Could you or anyone else tell an Ada novice why the program does'nt work with "access" but with "Unchecked_Access"? When I define my own "my_ac_GLfloat" in the same way "ac_GLfloat" is defined in win32.gl it works with "access". Matthew Heaney wrote: > Rolf Wester writes: > > Use T'Unchecked_Access. > > > Hi, > > > > I installed GNAT, AdaWin32 and GLUT according to the instructions on > > "Jerry's Ada on Win32 Page". I also downloaded the GLUT sources. When I > > try to compile the program ada_sphere_procs.adb (with win32.gl, > > win32.glu) I get the following error message: > > > > Compiling... > > ada_sphere_procs.adb:41:38: object has deeper accessibility level than > > access type > > ada_sphere_procs.adb:42:39: object has deeper accessibility level than > > access type > > > > The code fragment is: > > procedure init is > > > > light_diffuse : array(0 .. 3) of aliased GLfloat := > > (1.0, 0.0, 0.0, 1.0); > > light_position : array(0 .. 3) of aliased GLfloat := > > (1.0, 1.0, 1.0, 0.0); > > > > begin > > glClearColor(0.1, 0.1, 0.1, 0.0); > > > > glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse(0)'access); -- > > line 41 > > glLightfv(GL_LIGHT0, GL_POSITION, light_position(0)'access); -- > > line 42 > > > > The function glLightfv is defined in win32-gl.ads as: > > procedure glLightfv( > > light : GLenum; > > pname : GLenum; > > params: ac_GLfloat); > > > > and ac_GLfloat is defined as: > > type GLfloat is new Win32.FLOAT; > > type ac_GLfloat is access constant GLfloat; > > > > When I change the code to: > > > > procedure init is > > > > light_diffuse : array(0 .. 3) of aliased GLfloat := > > (1.0, 0.0, 0.0, 1.0); > > light_position : array(0 .. 3) of aliased GLfloat := > > (1.0, 1.0, 1.0, 0.0); > > type my_ac_GLfloat is access constant GLfloat; > > myFA : my_ac_GLfloat; > > FA : ac_GLfloat; > > begin > > glClearColor(0.1, 0.1, 0.1, 0.0); > > > > myFA := light_diffuse(0)'access; --line 43 > > FA := light_diffuse(0)'access; -- line 44 > > > > glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse(0)'access); > > --line 46 > > glLightfv(GL_LIGHT0, GL_POSITION, light_position(0)'access); -- > > line 47 > > > > I get the following error messages: > > > > Compiling... > > ada_sphere_procs.adb:44:13: object has deeper accessibility level than > > access type > > ada_sphere_procs.adb:46:38: object has deeper accessibility level than > > access type > > ada_sphere_procs.adb:47:39: object has deeper accessibility level than > > access type > > > > With my own my_ac_GLfloat on line 43 it's O.K. with the win32.gl > > ac_GLfloat > > used on line 44 it's an error! > > > > I would be very appreciative for any help. > > > > Thanks in anticipation > > > > - Rolf > > > > P.S.: Could anybody explain me the difference between > > type ac_GLfloat is access constant GLfloat; > > and > > type ac_GLfloat is access all GLfloat; > > > > > > ---------------------------------------------------------------------------- > > > > Rolf Wester > > Fraunhofer-Institute for Laser Technology > > Aachen > > Germany > > wester@ilt.fhg.de -- ------------------------------------------------------------ # Rolf Wester # Fraunhofer Institut f. Lasertechnik # Steinbachstr. 15, D-52074 Aachen, Germany. # Tel: + 49 (0) 241 8906 0, Fax: +49 (0) 241 8906 121 # EMail: wester@ilt.fhg.de, WWW: http://www.ilt.fhg.de