comp.lang.ada
 help / color / mirror / Atom feed
* Help: OpenGL doesn't draw with OA
@ 1997-06-13  0:00 Adrian B.Y. Hoe
  0 siblings, 0 replies; only message in thread
From: Adrian B.Y. Hoe @ 1997-06-13  0:00 UTC (permalink / raw)



Hello:

I am learning/experimenting OpenGL with OA for windows 7.0 I could not
have a white square drawn on a blank window with black background.
Below is my code. Can someone show me the correct way to do it?
Also, can someone explain how the AuxReshapeFunc and AuxMainLoop
work?

Thanks in advance for your valuable time and effort.


Adrian


---------------------------------------------------------------------------


with Win32.Gl;
with Win32.Glu;
with Win32.Glaux;
with Interfaces.C;
with Interfaces.C.Strings;
with System;
with Unchecked_Conversion;

use Win32.Gl;
use Win32.Glu;
use Win32.Glaux;
use Interfaces;

procedure TestOpenGL is

   function Conv is new Unchecked_Conversion (System.Address, AUXRESHAPEPROC);
   function Conv is new Unchecked_Conversion (System.Address, AUXMAINPROC);

   Window_Name : C.Char_Array := C.To_C("Test of OpenGL");
   Res         : Glenum;

   procedure MyInit;

   procedure Display;
   pragma Convention(Stdcall, Display);

   procedure MyInit is
   begin
      glClearColor(0.0, 0.0, 0.0, 0.0);
      glClear(GL_COLOR_BUFFER_BIT);
--      glColor3f(1.0, 1.0, 1.0);
--      glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
--      glBegin(GL_POLYGON);
--         glVertex3f(0.25, 0.25, 0.0);
--         glVertex3f(0.75, 0.25, 0.0);
--         glVertex3f(0.75, 0.75, 0.0);
--         glVertex3f(0.25, 0.75, 0.0);
--      glEnd;
--      glFlush;
   end MyInit;

   procedure Display is
   begin
      glColor3f(1.0, 1.0, 1.0);
      glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
      glBegin(GL_POLYGON);
         glVertex3f(0.25, 0.25, 0.0);
         glVertex3f(0.75, 0.25, 0.0);
         glVertex3f(0.75, 0.75, 0.0);
         glVertex3f(0.25, 0.75, 0.0);
      glEnd;
      glFlush;
   end Display;

begin
   AuxInitDisplayMode(AUX_SINGLE + AUX_RGB + AUX_DEPTH16);
   AuxInitPosition(0, 0, 400, 400);
   Res := AuxInitWindow(Window_Name(Window_Name'First)'Unchecked_Access);
   MyInit;
--   AuxReshapeFunc(Conv(MyReshape'Address));
   Auxmainloop(Conv(Display'Address));
end TestOpenGL;

----------------------------------------------------------------------------


--

B.Y.

---------------------------------------------------------------------------
 Adrian, B.Y. Hoe                     byHoe@quantum.pc.my           \/
 Business Development, VP                                         \/  \/
                                                                \/  \/  \/
                                      Phone : +60 3 495 4048      \/  \/
 Lexical Integration (M) Sdn Bhd      Fax   : +60 3 495 4037        \/
 13-B Jalan Pandan Indah 4/2, Pandan Indah, 55100 Kuala Lumpur-Malaysia
---------------------------------------------------------------------------




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1997-06-13  0:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-06-13  0:00 Help: OpenGL doesn't draw with OA Adrian B.Y. Hoe

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