From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Best way to put an array-based pixmap on a screen?
Date: Sun, 26 Mar 2017 10:25:01 +0200
Date: 2017-03-26T10:25:01+02:00 [thread overview]
Message-ID: <ob7tt0$1jmn$1@gioia.aioe.org> (raw)
In-Reply-To: cc019e12-33d8-4e05-910e-f9fc7f42fa06@googlegroups.com
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
next prev parent reply other threads:[~2017-03-26 8:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-26 1:01 Best way to put an array-based pixmap on a screen? LaeMing Ai
2017-03-26 8:25 ` Dmitry A. Kazakov [this message]
2017-03-26 9:55 ` Simon Wright
2017-03-26 13:27 ` reinert
2017-03-26 16:48 ` gautier_niouzes
2017-03-26 19:10 ` Lucretia
2017-03-26 19:13 ` Lucretia
2017-03-26 21:00 ` BartC
2017-03-26 21:48 ` Dmitry A. Kazakov
2017-03-26 9:35 ` Dirk Craeynest
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox