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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d12d5224bbb424c8,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-15 11:26:05 PST Path: supernews.google.com!sn-xit-03!supernews.com!newsfeed.wirehub.nl!news.maxwell.syr.edu!news.algonet.se!algonet!newsfeed1.uni2.dk!news.net.uni-c.dk!newsfeed.sunet.se!news01.sunet.se!news.chalmers.se!pluto.his.se!10.185.70.37 From: Michael Andersson Newsgroups: comp.lang.ada Subject: Ada newbie needs help! Date: Sun, 15 Apr 2001 20:27:57 +0200 Organization: Chalmers University of Technology Message-ID: <3AD9E82D.758343AA@ida.his.se> NNTP-Posting-Host: pluto.his.se Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------B99529724AE7B6377B5FFFED" X-Trace: nyheter.chalmers.se 987359144 24570 193.10.178.51 (15 Apr 2001 18:25:44 GMT) X-Complaints-To: abuse@chalmers.se NNTP-Posting-Date: 15 Apr 2001 18:25:44 GMT X-Mailer: Mozilla 4.75 [en] (X11; U; Linux 2.2.16-22 i686) X-Accept-Language: en Xref: supernews.google.com comp.lang.ada:6904 Date: 2001-04-15T18:25:44+00:00 List-Id: This is a multi-part message in MIME format. --------------B99529724AE7B6377B5FFFED Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi! I'm currently working on a little opengl application coded in Ada. The problem is that the application window just falshes the dies. There seems to be a problem with my callbacks but I can't find it. Please help me!!! /Michael Andersson --------------B99529724AE7B6377B5FFFED Content-Type: text/plain; charset=us-ascii; name="GUI.adb" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="GUI.adb" with Gtk; use Gtk; with GL_H; use GL_H; with Gtk.Glarea; use Gtk.Glarea; with Gtk.Main, Gtk.Widget; with Gtk.Window; use Gtk.Window; with Gdk.GL; use Gdk.Gl; with Gtk.Container; use Gtk.Container; with Gtk.Widget; use Gtk.Widget; with Gtk.Enums; use Gtk.Enums; with Gdk.Event; use Gdk.Event; with Gtk.Handlers; use Gtk.Handlers; with Gdk.Types; use Gdk.Types; with OpenGL; use OpenGL; with Gtk.Marshallers; use Gtk.Marshallers; with Gtk.Signal; use Gtk.Signal; with Ada.Text_IO; use Ada.Text_IO; procedure GUI is package EventRCB is new Gtk.Handlers.Return_Callback(Gtk_GLArea_Record, Boolean); package EventCB is new Gtk.Handlers.Callback(Gtk_GLArea_Record); type GtkGLAreaPtr is access all Gtk_GLArea_Record; Window : Gtk_Window; Area : GtkGlAreaPtr; begin Gtk.Main.Init; Gtk_New(Window, Window_Dialog); Gtk.Window.Set_Title(Window,"Simple"); Gtk.Window.Set_Border_Width(Window,10); Gtk.Window.Set_Default_Size(Window,500,500); Show(Window); Area := new Gtk_GLArea_Record; Initialize (Area,(GDK_GL_RGBA, GDK_GL_RED_SIZE, Gl_Configs (1), GDK_GL_GREEN_SIZE, Gl_Configs (1), GDK_GL_BLUE_SIZE, Gl_Configs (1), GDK_GL_DOUBLEBUFFER, GDK_GL_DEPTH_SIZE, Gl_Configs (1))); if Area = null then Put_Line("Can't recate Gtk_GLArea"); return; end if; Set_Events(Area, Exposure_Mask); --EventRCB.Connect(Area, "exposure_event", EventRCB.To_Marshaller(Display'Access)); --EventRCB.Connect(Area, "configure_event", EventRCB.To_Marshaller(Reshape'Access)); EventRCB.Connect(Area, "realize", EventRCB.To_Marshaller(InitGL'Access)); --Gtk.Signal.Signal_Connect(Area, "realize", InitGL'Access, null); Add(Window, Area); Gtk.Main.Main; end GUI; --------------B99529724AE7B6377B5FFFED Content-Type: text/plain; charset=us-ascii; name="opengl.adb" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="opengl.adb" with Gtk.Main; with Gtk.Window; use Gtk.Window; with Glu_H; use Glu_H; with GL_H; use GL_H; with Gtk.Glarea; use Gtk.Glarea; with Gdk.GL; use Gdk.Gl; with Ada.Text_IO; use Ada.Text_IO; with Gdk.Event; use Gdk.Event; with Gtk.Handlers; use Gtk.Handlers; package body OpenGL is function InitGL(Area : access Gtk_GLArea_Record'Class) return Boolean is begin if Make_Current(Area) then Glclearcolor(0.0,0.0,0.0,0.0); Glenable(GL_DEPTH_TEST); Glshademodel(GL_SMOOTH); end if; return True; end InitGL; function Reshape(Area : access Gtk_GLArea_Record'Class; Event : Gdk_Event) return Boolean is begin if Get_Count(Event) > 0 then return True; end if; if Make_Current(Area) then Glviewport(0,0,500,500); Glmatrixmode(GL_PROJECTION); Glloadidentity; Gluperspective(Long_Float (45.0), Long_Float(1.3), 1.0,100.0); Glmatrixmode(GL_MODELVIEW); Glloadidentity; end if; return True; end Reshape; function Display(Area: access Gtk_GLArea_Record'Class; Event : Gdk_Event) return Boolean is begin if Make_Current(Area) then Glclear(GL_COLOR_BUFFER_BIT); Glclear(GL_DEPTH_BUFFER_BIT); Glloadidentity; Gltranslatef(0.0,0.0,-5.0); Glbegin(GL_QUADS); Glvertex3f(-2.0,0.0,0.0); Glvertex3f(-2.0,2.0,0.0); Glvertex3f(2.0,2.0,0.0); Glvertex3f(2.0,0.0,0.0); Glend; Swap_Buffers(Area); end if; return True; end Display; end OpenGL; --------------B99529724AE7B6377B5FFFED Content-Type: text/plain; charset=us-ascii; name="opengl.ads" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="opengl.ads" with Gtk; use Gtk; with GL_H; use GL_H; with Gtk.Glarea; use Gtk.Glarea; with Gtk.Main, Gtk.Widget; with Gtk.Window; use Gtk.Window; with Gdk.GL; use Gdk.Gl; with Gtk.Container; use Gtk.Container; with Gtk.Widget; use Gtk.Widget; with Gtk.Enums; use Gtk.Enums; with Gdk.Event; use Gdk.Event; with Gtk.Handlers; use Gtk.Handlers; with Gdk.Types; use Gdk.Types; with Gtk.Marshallers; use Gtk.Marshallers; with Gtk.Signal; use Gtk.Signal; with Ada.Text_IO; use Ada.Text_IO; with Glib; use Glib; package OpenGL is function InitGL(Area : access Gtk_GLArea_Record'Class) return Boolean; function Display(Area : access Gtk_GLArea_Record'Class; Event : Gdk_Event) return Boolean; function Reshape(Area : access Gtk_GLArea_Record'Class; Event : Gdk_Event) return Boolean; end OpenGL; --------------B99529724AE7B6377B5FFFED--