[gtkada] testgtk/opengl/lw.c code incompatible with supplied graphics file

Roger Mc Murtrie rogermc at grapevine.com.au
Tue Sep 27 08:30:25 CEST 2016



> Begin forwarded message:
> 
> From: Roger Mc Murtrie <rogermc at grapevine.com.au>
> Subject: Re: [gtkada] testgtk/opengl/lw.c code incompatible with supplied graphics file
> Date: 27 September 2016 at 4:29:13 PM AEST
> To: Pascal <p.p14 at orange.fr>
> 
> Hello Pascal,
> 	I decided to to write the LWO2  parser straight off in Ada, as I find the C code somewhat horrendous.
> I'm making slow but steady progress, learning and re-learning Ada techniques as I go along.
> Fortunately, a few years ago, I wrote a fairly sophisticated parser for a scientific application; so I have that to look back on for Ada programming clues.
> I'm hopeful of having a parser that at least parses the pigeon file up and running in a couple of weeks.
> Best regards,
> Roger
> 
> 
>> On 11 Sep 2016, at 9:13 PM, Pascal <p.p14 at orange.fr> wrote:
>> 
>> Hello Roger,
>> 
>> I did work :-)
>> This sounds like a little bell to me, thus I find out very old patches from GTKAda 2.24.2 and 3.4.2 :
>> 
>> *** ./testgtk/Makefile.0	2011-07-24 08:50:35.000000000 +0200
>> --- ./testgtk/Makefile	2011-07-24 08:58:27.000000000 +0200
>> ***************
>> *** 21,26 ****
>> --- 21,27 ----
>> 
>> ifeq ($(HAVE_OPENGL),True)
>> OPENGL_C_OBJECTS=lw.o
>> + OPENGL_FLAGS     = -I/usr/X11/include
>> OPENGL_LIBS= -L/usr/X11/lib -lGLU -lGL
>> GTKADA_GL_LIBS=-lgtkada_gl
>> else
>> ***************
>> *** 42,48 ****
>> 	  opengl/view_gl.gpb opengl/view_gl.adb
>> 
>> lw.o: opengl/lw.c opengl/lw.h
>> ! 	$(CC) -c opengl/lw.c -Iopengl -D_REENTRANT -I/usr/local/gtk-2011/include/gtk-2.0 -I/usr/local/gtk-2011/lib/gtk-2.0/include -I/usr/local/gtk-2011/include/atk-1.0 -I/usr/local/gtk-2011/include/cairo -I/usr/local/gtk-2011/include/gdk-pixbuf-2.0 -I/usr/local/gtk-2011/include/pango-1.0 -I/usr/local/gtk-2011/include/glib-2.0 -I/usr/local/gtk-2011/lib/glib-2.0/include -I/usr/local/gtk-2011/include/libpng12 -I/usr/local/gtk-2011/include/freetype2 -I/usr/local/gtk-2011/include  
>> 
>> install: force
>> 	$(MKDIR) $(examples)
>> --- 43,49 ----
>> 	  opengl/view_gl.gpb opengl/view_gl.adb
>> 
>> lw.o: opengl/lw.c opengl/lw.h
>> ! 	$(CC) -c opengl/lw.c $(OPENGL_FLAGS) -Iopengl -D_REENTRANT -I/usr/local/gtk-2011/include/gtk-2.0 -I/usr/local/gtk-2011/lib/gtk-2.0/include -I/usr/local/gtk-2011/include/atk-1.0 -I/usr/local/gtk-2011/include/cairo -I/usr/local/gtk-2011/include/gdk-pixbuf-2.0 -I/usr/local/gtk-2011/include/pango-1.0 -I/usr/local/gtk-2011/include/glib-2.0 -I/usr/local/gtk-2011/lib/glib-2.0/include -I/usr/local/gtk-2011/include/libpng12 -I/usr/local/gtk-2011/include/freetype2 -I/usr/local/gtk-2011/include  
>> 
>> install: force
>> 	$(MKDIR) $(examples)
>> 
>> --- ./testgtk/opengl/view_gl.gpb.0	2013-04-29 14:59:10.000000000 +0200
>> +++ ./testgtk/opengl/view_gl.gpb	2013-08-10 17:56:18.000000000 +0200
>> @@ -95,9 +95,9 @@
>>   begin
>>      --  Draw only the last expose event
>> 
>> -      if Get_Count (Event) > 0 then
>> -         return True;
>> -      end if;
>> +--       if Get_Count (Event) > 0 then
>> +--          return True;
>> +--       end if;
>> 
>>      --  OpenGL calls can be done only if make_current returns true
>> 
>> @@ -181,8 +181,8 @@
>>      --  automatically by GtkAda
>>   begin
>>      if Get_Button (Event) = 1 then
>> -         Area.Mesh_Info.Beginx := Float (Get_X (Event));
>> -         Area.Mesh_Info.Beginy := Float (Get_Y (Event));
>> +--         Area.Mesh_Info.Beginx := Float (Get_X (Event));
>> +--         Area.Mesh_Info.Beginy := Float (Get_Y (Event));
>>         return True;
>>      end if;
>>      return False;
>> @@ -199,18 +199,18 @@
>>      --  Event is an Gdk_Event_Motion, but no need to cast, this is tested
>>      --  automatically by GtkAda
>>      X, Y : Gint;
>> -      Win  : Gdk_Window;
>> +      Win  : GDK.Gdk_Window;
>>      State : Gdk_Modifier_Type;
>>      Rect  : Gdk_Rectangle;
>> 
>>   begin
>> -      if Get_Is_Hint (Event) then
>> +--      if Get_Is_Hint (Event) then
>>         Get_Pointer (Get_Window (Event), X, Y, State, Win);
>> -      else
>> -         X := Gint (Get_X (Event));
>> -         Y := Gint (Get_Y (Event));
>> -         State := Get_State (Event);
>> -      end if;
>> +--      else
>> +--         X := Gint (Get_X (Event));
>> +--         Y := Gint (Get_Y (Event));
>> +--         State := Get_State (Event);
>> +--      end if;
>>      Rect.X := 0;
>>      Rect.Y := 0;
>>      Rect.Width  := Get_Allocated_Width (Area);
>> 
>> 
>> Let have a try ;-)
>> 
>> HTH, Pascal.
>> http://blady.pagesperso-orange.fr
>> 
>> 
>>> Le 11 sept. 2016 à 02:43, Roger Mc Murtrie <rogermc at grapevine.com.au> a écrit :
>>> 
>>> OSX 10.11.6
>>> Xcode 7.3.1
>>> lw.c code appears incompatible with the supplied graphics file, penguin.lwo as
>>> the penguin.lwo file format is LWO2 whereas the lw.c parser is for LWOB.
>>> I have adapted a parser from the Lightwaves SDK to generate an lwObject for the LWO2 format and
>>> am currently attempting to write a show function to process my LWO2 lwObject.
>>> If I ever succeed with this I hope to then reprogram the whole thing in Ada.
>>> Roger
>>> _______________________________________________
>>> gtkada mailing list
>>> gtkada at lists.adacore.com
>>> http://lists.adacore.com/mailman/listinfo/gtkada
>> 
> 



More information about the gtkada mailing list