comp.lang.ada
 help / color / mirror / Atom feed
From: Redmond Urbino <redmond.urbino@bigfoot.com>
To: Pascal Obry <pascal.obry@der.edfgdf.fr>
Subject: Re: GNAT and OPENGL in windows NT
Date: 1997/12/03
Date: 1997-12-03T00:00:00+00:00	[thread overview]
Message-ID: <3485F74D.2D45@bigfoot.com> (raw)
In-Reply-To: 6635al$cg5$1@cf01.edf.fr


Please help.  I am trying to get a simple openg gl program to run using
gnat on windows nt.
I'm using gnat 3.10, the latest win32ada, vc++ 5.0, and  nt 4.0

I tried adding the option to gnatmake
   -largs \vc\include\opengl32.lib \vc\include\glu32.lib
\vc\lib\glaux.lib
I get lots of linker warnings like:
  ld: r:\vc\lib\opengl32.lib(OPENGL32.dll): warning: ignoring duplicate
section `.text'
  ld: r:\vc\lib\opengl32.lib(OPENGL32.dll): warning: ignoring duplicate
section `.idata$5'
  ld: r:\vc\lib\opengl32.lib(OPENGL32.dll): warning: ignoring duplicate
section `.text'
  ld: r:\vc\lib\opengl32.lib(OPENGL32.dll): warning: ignoring duplicate
section `.idata$5'
I get an executable, but it wont run and I get an error that it has not
been initialized properly


If I don't include those libraries, I get linker errors like:
  ./cube.o(.text+0xfb):cube.adb: undefined reference to `glFlush@0'
  ./cube.o(.text+0x196):cube.adb: undefined reference to
`auxInitDisplayMode@4'

Thanks in advance.
   

--------------------------------------------------------------------------------------------------
--  
-- Author : Pascal Obry
--
-- This is a sample program to show some OpenGL features.
--
-- It compile fine under GNAT 3.04a. You must add the following
-- libraries : OPENGL32.LIB GLU32.LIB GLAUX.LIB
--

with win32.Gl;

with win32.Glaux;
with Interfaces.C;
with Interfaces.C.Strings;
with System;
with Unchecked_Conversion;

procedure Cube is

   use win32.Gl;

   use win32.Glaux;
   use Interfaces;
                                       
   function Conv is new Unchecked_Conversion (System.Address,
AUXRESHAPEPROC);
   function Conv is new Unchecked_Conversion (System.Address,
AUXMAINPROC);
   function conv is new unchecked_conversion (system.address, 
win32.lpcstr);

   --Window_Name : aliased Interfaces.C.Char_Array := Interfaces.C.To_C
("Perspective 3-D Cube");
   Window_Name : array (1..21) of aliased character := "Perspective 3-D
Cube" & ascii.nul;
   Res : Glenum;

   --  callbacks must be defined with the Stdcall Convention
   procedure MyReshape (W, H : in Glsizei);
   pragma Convention (Stdcall, MyReshape);

   procedure Display;
   pragma Convention (Stdcall, Display);

   --  here start the definition of the gl scene.
   procedure MyInit is
   begin
      GlShadeModel (GL_FLAT);
   end MyInit;

   procedure MyReshape (W, H : in Glsizei) is
   begin
      GlMatrixMode (GL_PROJECTION);
      GlLoadIdentity;
      GlFrustum (-1.0, 1.0, -1.0, 1.0, 1.5, 20.0);
      GlMatrixMode (GL_MODELVIEW);
      GlViewPort (0, 0, W, H);
   end MyReshape;

   procedure Display is
   begin
      GlClear (GL_COLOR_BUFFER_BIT);
      GlColor3f (1.0, 1.0, 1.0);
      GlLoadIdentity;
      GlTranslatef (0.0, 0.0, -5.0);
      GlScalef (1.0, 2.0, 1.0);
      AuxWireCube (1.0);
      GlFlush;
   end Display;

begin
   AuxInitDisplayMode (AUX_SINGLE + AUX_RGB);
   AuxInitPosition (0, 0, 500, 500);
   Res := AuxInitWindow (conv(Window_Name (Window_Name'First)'address));
   MyInit;
   AuxReshapeFunc (Conv(MyReshape'Address));
   Auxmainloop (Conv(Display'Address));
end Cube;




      reply	other threads:[~1997-12-03  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-12-02  0:00 GNAT and OPENGL in windows NT Redmond Urbino
1997-12-03  0:00 ` Pascal Obry
1997-12-03  0:00   ` Redmond Urbino [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