POV-Ray : Newsgroups : povray.off-topic : Learning C++ : Re: Learning C++ Server Time
6 Sep 2024 21:21:58 EDT (-0400)
  Re: Learning C++  
From: Warp
Date: 12 Dec 2008 08:44:30
Message: <49426abe@news.povray.org>
Invisible <voi### [at] devnull> wrote:
> >   OTOH one small problem with C++ is that there is no standard way of
> > drawing any graphics.

> ...and this is the reason why. Almost *no* languages have the capability 
> to easily draw graphics these days.

  Some languages, such as Java, come with standard libraries for drawing
graphics, but in general the no-graphics-libraries trend is probably
because languages want to be portable, and it's very hard to make portable
yet efficient generic graphic libraries.

  OpenGL is a very good, cross-language attempt, but you can't do
*everything* with it. Its target application range is rather narrow
(basically only hardware-accelerated 3D and 2D graphics, but it doesn't
have any support for eg. windowing systems).

> (Back when I was a kid, you could just say "plot 4, 7" and it would draw 
> a dot there. Ah, I had no idea how good I had it!)

  In those days portability was not an issue for the people who made the
compilers.

> > And you should forget
> > trying to program with the Windows API directly, unless you have *tons* of
> > experience with it, or you want to die prematurely.

> This made me actually laugh out loud. For real. Such a glowing 
> recommendation of the Win32 API! :-D

> (OTOH, I understand that the raw X Windows bindings are even harder... 
> apparently... I guess that's why there's so many toolkits!)

  I once tried to look how I would create a simple dialog which contained
some radio buttons, textfields and buttons directly with the Win32 API, and
I was absolutely horrified at how horrendously difficult it is.

  With a graphical toolkit such as GTK you simply say that you want a modal
window, it's composed of some elements eg. arranged vertically, and then
you simply add those elements to it. You don't have to specify how they
should look like, their coordinates on the window, or anything. You just
tell it *what* you want, and how it should be arranged. It's surprisingly
simple even though it's a C library, once you get used to it.

  With the Win32 API you have to define *absolutely* everything by hand.
Every pixel coordinate, every width and height, every color. Everything.
And often in the hardest possible way.

  The standard answer to this is "you don't create windows with the Win32
API directly, you use a graphical GUI creation software, and it will
generate the coordinates for you".

  The only problem in this particular case is that, AFAIK, VS Express does
*not* come with such a GUI creation module. (At least VS 2005 Express didn't.)

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.