www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Re: SciD: the humble beginning

reply Eldar Insafutdinov <e.insafutdinov gmail.com> writes:
dsimcha Wrote:

 Plotting.  I've considered doing this a few times, but I've decided it needs
to be
 put off until D2 is stable and the GUI toolkits for it are reasonably stable. 
One
 layer of instability (D2 itself) is workable, but two layers (D2 and the GUI
libs)
 is not.
 

It would be unfair not to mention GtkD which nobody has done in your D2 GUI libs thread. I think that so far it is the most mature and stable cross-platform D2 GUI toolkit. It's been a year since it reached version 1.0, so you should probably consider it. And GTK looks just fine on windows.
Dec 13 2009
parent reply dsimcha <dsimcha yahoo.com> writes:
== Quote from Eldar Insafutdinov (e.insafutdinov gmail.com)'s article
 dsimcha Wrote:
 Plotting.  I've considered doing this a few times, but I've decided it needs
to be
 put off until D2 is stable and the GUI toolkits for it are reasonably stable. 
One
 layer of instability (D2 itself) is workable, but two layers (D2 and the GUI
libs)
 is not.


toolkit. It's been a year since it reached version 1.0, so you should probably consider it. And GTK looks just fine on windows. Is it fast and stable on D2? You're right that noone specifically mentioned it, I just got the vibe that there's no reasonably stable D2 GUI lib yet. If you believe GtkD is stable enough to build other D2 libs on top of, that would be great. Also, correct me if I'm wrong, but I thought GTK made the tradeoff of being XML-based and therefore relatively slow but more flexible. I absolutely 150% refuse to build a plotting library that chokes and takes a significant amount of time to redraw complex plots when a window is resized or moved, no matter how good it looks, how many features it has, or how extensible it is.
Dec 13 2009
next sibling parent reply Eldar Insafutdinov <e.insafutdinov gmail.com> writes:
dsimcha Wrote:

 == Quote from Eldar Insafutdinov (e.insafutdinov gmail.com)'s article
 dsimcha Wrote:
 Plotting.  I've considered doing this a few times, but I've decided it needs
to be
 put off until D2 is stable and the GUI toolkits for it are reasonably stable. 
One
 layer of instability (D2 itself) is workable, but two layers (D2 and the GUI
libs)
 is not.


toolkit. It's been a year since it reached version 1.0, so you should probably consider it. And GTK looks just fine on windows. Is it fast and stable on D2? You're right that noone specifically mentioned it, I just got the vibe that there's no reasonably stable D2 GUI lib yet. If you believe GtkD is stable enough to build other D2 libs on top of, that would be great. Also, correct me if I'm wrong, but I thought GTK made the tradeoff of being XML-based and therefore relatively slow but more flexible. I absolutely 150% refuse to build a plotting library that chokes and takes a significant amount of time to redraw complex plots when a window is resized or moved, no matter how good it looks, how many features it has, or how extensible it is.

GTK uses Cairo library for drawing and I don't think there should be any trade-offs. GtkD contains bindings to Cairo and a few examples, but I haven't tried it myself. As for its stability of D2 version - I can't be sure, as I don't use it, but I've always thought it is reasonably stable. Developers of GtkD should know better of course. There were some benchmarks comparing drawing performance of Gtk and Qt, and Qt was a magnitude faster. Also there has been done a lot of work on OpenGL backend for Qt, which will make things even faster. And as I said earlier on Qt already has plotting library Qwt (which is used for instance at the company I am working for). But you'd have to wait for a month or so until we finish our work.
Dec 13 2009
parent reply dsimcha <dsimcha yahoo.com> writes:
== Quote from Eldar Insafutdinov (e.insafutdinov gmail.com)'s article
 dsimcha Wrote:
 == Quote from Eldar Insafutdinov (e.insafutdinov gmail.com)'s article
 dsimcha Wrote:
 Plotting.  I've considered doing this a few times, but I've decided it




 put off until D2 is stable and the GUI toolkits for it are reasonably




 layer of instability (D2 itself) is workable, but two layers (D2 and the




 is not.


toolkit. It's been a year since it reached version 1.0, so you should probably consider it. And GTK looks just fine on windows. Is it fast and stable on D2? You're right that noone specifically mentioned it, I just got the vibe that there's no reasonably stable D2 GUI lib yet. If you believe GtkD is stable enough to build other D2 libs on top of, that would be


 Also, correct me if I'm wrong, but I thought GTK made the tradeoff of being
 XML-based and therefore relatively slow but more flexible.  I absolutely 150%
 refuse to build a plotting library that chokes and takes a significant amount
of
 time to redraw complex plots when a window is resized or moved, no matter how
good
 it looks, how many features it has, or how extensible it is.


tried it myself. As for its stability of D2 version - I can't be sure, as I don't use it, but I've always thought it is reasonably stable. Developers of GtkD should know better of course.
 There were some benchmarks comparing drawing performance of Gtk and Qt, and Qt

for Qt, which will make things even faster. And as I said earlier on Qt already has plotting library Qwt (which is used for instance at the company I am working for). But you'd have to wait for a month or so until we finish our work. I'm starting to get the feeling that the best way to figure out what GUI lib to use would be to create a prototype of a very small portion of functionality (maybe just bare-bones scatter plots or something easy like that) in each lib and benchmark it and see what the relative difficulty is. The other option is to make sure everything is loosely coupled to the GUI lib so it can be easily swapped for another one. The downside is that this has some tradeoffs in terms of simplicity and probably performance that I don't think I want to make and is probably a classic example of overengineering.
Dec 13 2009
parent reply Chad J <chadjoan __spam.is.bad__gmail.com> writes:
dsimcha wrote:
 
 ...  The other option is to make
 sure everything is loosely coupled to the GUI lib so it can be easily swapped
for
 another one.  The downside is that this has some tradeoffs in terms of
simplicity
 and probably performance that I don't think I want to make and is probably a
 classic example of overengineering.

Is it really that hard to have the GUI libs in question just give you some pixels in memory or an opengl context? Then you could use your own highly optimized plot drawing routines instead of relying on the GUI lib to do this. I figured this kind of thing would be unbeatable for performance, unless the library ties your hands.
Dec 14 2009
next sibling parent reply Lutger <lutger.blijdestijn gmail.com> writes:
Chad J wrote:

 dsimcha wrote:
 
 ...  The other option is to make
 sure everything is loosely coupled to the GUI lib so it can be easily
 swapped for
 another one.  The downside is that this has some tradeoffs in terms of
 simplicity and probably performance that I don't think I want to make and
 is probably a classic example of overengineering.

Is it really that hard to have the GUI libs in question just give you some pixels in memory or an opengl context? Then you could use your own highly optimized plot drawing routines instead of relying on the GUI lib to do this. I figured this kind of thing would be unbeatable for performance, unless the library ties your hands.

If you are willing to do opengl (it's a bit more work) then I think that is a very good idea. Both QtD and GtkD should have good opengl interop, so you could at a later stage support both libraries.
Dec 15 2009
parent Lutger <lutger.blijdestijn gmail.com> writes:
Lutger wrote:

 Chad J wrote:
 
 dsimcha wrote:
 
 ...  The other option is to make
 sure everything is loosely coupled to the GUI lib so it can be easily
 swapped for
 another one.  The downside is that this has some tradeoffs in terms of
 simplicity and probably performance that I don't think I want to make
 and is probably a classic example of overengineering.

Is it really that hard to have the GUI libs in question just give you some pixels in memory or an opengl context? Then you could use your own highly optimized plot drawing routines instead of relying on the GUI lib to do this. I figured this kind of thing would be unbeatable for performance, unless the library ties your hands.

If you are willing to do opengl (it's a bit more work) then I think that is a very good idea. Both QtD and GtkD should have good opengl interop, so you could at a later stage support both libraries.

On second thought, you will lose performance dramatically on systems that don't have a good opengl driver / graphics card.
Dec 15 2009
prev sibling parent reply dsimcha <dsimcha yahoo.com> writes:
== Quote from Chad J (chadjoan __spam.is.bad__gmail.com)'s article
 dsimcha wrote:
 ...  The other option is to make
 sure everything is loosely coupled to the GUI lib so it can be easily swapped
for
 another one.  The downside is that this has some tradeoffs in terms of
simplicity
 and probably performance that I don't think I want to make and is probably a
 classic example of overengineering.

some pixels in memory or an opengl context? Then you could use your own highly optimized plot drawing routines instead of relying on the GUI lib to do this. I figured this kind of thing would be unbeatable for performance, unless the library ties your hands.

I had considered this. The biggest problem is font rendering.
Dec 15 2009
next sibling parent Michal Minich <michal.minich gmail.com> writes:
 Is it really that hard to have the GUI libs in question just give you
 some pixels in memory or an opengl context?  Then you could use your
 own highly optimized plot drawing routines instead of relying on the
 GUI lib to do this.  I figured this kind of thing would be unbeatable
 for performance, unless the library ties your hands.
 


on Windows, function CreateDIBSection can be used to create block of memory directly accessible by application, while it can be used for GDI functions, including text rendering. I use it in some D code, and it is quite easier to use than it may look from the docs. http://msdn.microsoft.com/en-us/library/dd183494%28VS.85%29.aspx
Dec 15 2009
prev sibling next sibling parent Lukas Pinkowski <Lukas.Pinkowski web.de> writes:
dsimcha wrote:
 Is it really that hard to have the GUI libs in question just give you
 some pixels in memory or an opengl context?  Then you could use your own
 highly optimized plot drawing routines instead of relying on the GUI lib
 to do this.  I figured this kind of thing would be unbeatable for
 performance, unless the library ties your hands.

I had considered this. The biggest problem is font rendering.

In case of Qt, you can use a QGraphicsView on an OpenGL-widget. You can draw a 'background' with OpenGL (your plot) and render text with QGraphicsTextItem.
Dec 15 2009
prev sibling parent Chad J <chadjoan __spam.is.bad__gmail.com> writes:
dsimcha wrote:
 == Quote from Chad J (chadjoan __spam.is.bad__gmail.com)'s article
 Is it really that hard to have the GUI libs in question just give you
 some pixels in memory or an opengl context?  Then you could use your own
 highly optimized plot drawing routines instead of relying on the GUI lib
 to do this.  I figured this kind of thing would be unbeatable for
 performance, unless the library ties your hands.

I had considered this. The biggest problem is font rendering.

I think Tom (h3r3t1c) has some good font drawing code laying around. I've made some crappy font drawing code at some point. It's quite doable and the game developing peeps around here should have font rendering code. It seems to come with the territory. Hopefully someone won't mind sharing. At the end of the day this probably just means depending on FreeType2 and borrowing some code. That and also what everyone else was saying.
Dec 15 2009
prev sibling next sibling parent Bill Baxter <wbaxter gmail.com> writes:
On Tue, Dec 15, 2009 at 1:00 AM, Lutger <lutger.blijdestijn gmail.com> wrot=
e:
 Chad J wrote:

 dsimcha wrote:
 ... =A0The other option is to make
 sure everything is loosely coupled to the GUI lib so it can be easily
 swapped for
 another one. =A0The downside is that this has some tradeoffs in terms o=



 simplicity and probably performance that I don't think I want to make a=



 is probably a classic example of overengineering.

Is it really that hard to have the GUI libs in question just give you some pixels in memory or an opengl context? =A0Then you could use your o=


 highly optimized plot drawing routines instead of relying on the GUI lib
 to do this. =A0I figured this kind of thing would be unbeatable for
 performance, unless the library ties your hands.

If you are willing to do opengl (it's a bit more work) then I think that =

 a very good idea. Both QtD and GtkD should have good opengl interop, so y=

 could at a later stage support both libraries.

Biggest problem with OpenGL is that the quality is crap for 2D stuff, and quality really matters when you're trying to do something like draw 2000 little markers on a plot and each is only 5 pixels wide. Best you can do right now with GL without a lot of contortions is something like 16x oversampling, but that only works on fairly recent / high-end cards (no chance on an intel integrated chipset, for instance). With analytical antialiasing you get 256 levels (vs just 16 with hardware AA). The quality difference is very noticeable, especially on plots with lots of fine lines and tiny markers. --bb
Dec 15 2009
prev sibling next sibling parent =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= <jeberger free.fr> writes:
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable

dsimcha wrote:
 =3D=3D Quote from Eldar Insafutdinov (e.insafutdinov gmail.com)'s artic=

 dsimcha Wrote:
 Plotting.  I've considered doing this a few times, but I've decided i=



 put off until D2 is stable and the GUI toolkits for it are reasonably=



 layer of instability (D2 itself) is workable, but two layers (D2 and =



 is not.



 thread. I think that so far it is the most mature and stable cross-plat=

 toolkit. It's been a year since it reached version 1.0, so you should p=

 consider it. And GTK looks just fine on windows.
=20
 Is it fast and stable on D2?  You're right that noone specifically ment=

 just got the vibe that there's no reasonably stable D2 GUI lib yet.  If=

 believe GtkD is stable enough to build other D2 libs on top of, that wo=

=20
 Also, correct me if I'm wrong, but I thought GTK made the tradeoff of b=

 XML-based and therefore relatively slow but more flexible.  I absolutel=

 refuse to build a plotting library that chokes and takes a significant =

 time to redraw complex plots when a window is resized or moved, no matt=

 it looks, how many features it has, or how extensible it is.

Gtk itself isn't XML based, it is pure compiled C and therefore as=20 fast as your compiler can make it. The only thing that's XML in Gtk=20 is dynamic GUI loading: you can define your entire GUI through an=20 XML file and have it loaded dynamically by your program. And even in=20 that case, once the GUI is loaded it becomes again pure C. I don't=20 see why GtkD would be any different. Jerome --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.fr
Dec 15 2009
prev sibling next sibling parent "Simen kjaeraas" <simen.kjaras gmail.com> writes:
Bill Baxter <wbaxter gmail.com> wrote:

 Biggest problem with OpenGL is that the quality is crap for 2D stuff,
 and quality really matters when you're trying to do something like
 draw 2000 little markers on a plot and each is only 5 pixels wide.

 Best you can do right now with GL without a lot of contortions is
 something like 16x oversampling, but that only works on fairly recent
 / high-end cards (no chance on an intel integrated chipset, for
 instance).  With analytical antialiasing you get 256 levels (vs just
 16 with hardware AA).  The quality difference is very noticeable,
 especially on plots with lots of fine lines and tiny markers.

You might get away with generating textures at 2-4 times the wanted resolution, and generate mipmaps for the texture, then read from the mipmap. Somewhat of a roundabout way of getting the image, but unless you're using huge textures, it should work. (And even if you're using huge textures, you can split the job. ) -- Simen
Dec 15 2009
prev sibling parent Bill Baxter <wbaxter gmail.com> writes:
On Tue, Dec 15, 2009 at 3:22 PM, Simen kjaeraas <simen.kjaras gmail.com> wr=
ote:
 Bill Baxter <wbaxter gmail.com> wrote:

 Biggest problem with OpenGL is that the quality is crap for 2D stuff,
 and quality really matters when you're trying to do something like
 draw 2000 little markers on a plot and each is only 5 pixels wide.

 Best you can do right now with GL without a lot of contortions is
 something like 16x oversampling, but that only works on fairly recent
 / high-end cards (no chance on an intel integrated chipset, for
 instance). =A0With analytical antialiasing you get 256 levels (vs just
 16 with hardware AA). =A0The quality difference is very noticeable,
 especially on plots with lots of fine lines and tiny markers.

You might get away with generating textures at 2-4 times the wanted resolution, and generate mipmaps for the texture, then read from the mipmap. Somewhat of a roundabout way of getting the image, but unless you're using huge textures, it should work. (And even if you're using huge textures, you can split the job. )

Yes, those are the kind of contortions I was talking about. Or you could do N passes, do a sub-pixel jitter of the camera each pass, and accumulate. Then you can essentially get whatever quality you want if you're patient enough. Or you could just use a library written for doing anti-aliased 2D graphics. Best justification for using OpenGL, in my opinion, is in order to facilitate support of 3D plotting at some point in the future. That seems to be difficult to retro-fit once you've gone deep down the 2D rabbit hole. At least Matplotlib (based on AGG) seems to be having trouble getting anywhere with 3D plots. --bb
Dec 15 2009