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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Best way to put an array-based pixmap on a screen? Date: Sun, 26 Mar 2017 10:25:01 +0200 Organization: Aioe.org NNTP Server Message-ID: References: NNTP-Posting-Host: BYuA7L7MRjuLLjcoGHOBxw.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:46457 Date: 2017-03-26T10:25:01+02:00 List-Id: On 2017-03-26 03:01, LaeMing Ai wrote: > I am hoping to learn some Ada with an explicit interest in simple > software 3D rendering (ie: writing the render code in Ada, NOT calling > external libraries such as OpenGL). Usually there is no access to the display around the OS. You will have to use some external library this or that way. > I particularly don't want event loops, or anything else dragged in > from outside the Ada environment if at all possible - the point of > using Ada is to learn to do all that /in/ Ada! You cannot draw into the RAMDAC, for obvious reasons. You do into a window controlled by the window manager. The window can get exposed, obscured, minimized etc. That brings a lot of stuff with it, events included. > I have played around with some AdaGTK examples but keep getting bogged down :-( . That is because you looked at the wrong place. Rendering under Gtk is done through Cairo (or far less frequently through OpenGL). Earlier versions of Gtk (<3.0) used other, very limited compared to Cairo, means. This is the stuff you probably found. Forget it, it is no longer supported. Cairo rendering is more or less simple: https://www.cairographics.org/tutorial From the Gtk side you need a widget to draw into. The best candidate is Gtk_Drawing_Area for which you have to provide a handler of "draw" event. In the handler you receive a Cairo context, where all your drawing goes. As an example you can take the Gtk_Layered widget. It consists of layers drawn upon each other: http://www.dmitry-kazakov.de/ada/aicwl.htm#2 You also can derive your own layer from the Abstract_Layer and let Gtk_Layered draw it. If drawing pixmaps is the only thing you need, that is even simpler: http://www.dmitry-kazakov.de/ada/gtkada_contributions.htm#3 You can compile an XPM image into Ada code and use that to either to draw into a Cairo context (see above) or as a stand-alone image widget Gtk_Image. P.S. An alternative to Gtk/Cairo is Qt. There are Ada Qt bindings as well. People here will surely help you with that too. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de