POV-Ray : Newsgroups : povray.off-topic : Learning C++ Server Time
6 Sep 2024 21:21:43 EDT (-0400)
  Learning C++ (Message 38 to 47 of 57)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Darren New
Subject: Re: Learning C++
Date: 12 Dec 2008 13:51:37
Message: <4942b2b9$1@news.povray.org>
Darren New wrote:
> Sadly, I'm utterly uninspired about what to write past my first usual 
> program, namely "Jotto".  Any suggestions?

Actually, I just remembered I wanted to take that permutation code from 
bork.bork.bork that Warp posted and try to instrument it to figure out 
what's going on. I should be able to do that with text, then turn that up to 
using graphics (colored arrows showing things moving about or so) when I get 
to the point of using a graphics library.

(You know, sort of like those things you find where they show you 
graphically the array after each sort so you can see how the sort works 
dynamically? Like that.)

-- 
   Darren New, San Diego CA, USA (PST)
   The NFL should go international. I'd pay to
   see the Detroit Lions vs the Roman Catholics.


Post a reply to this message

From: Bill Pragnell
Subject: Re: Learning C++
Date: 12 Dec 2008 13:53:57
Message: <4942b345$1@news.povray.org>
Invisible wrote:
> Warp wrote:
> 
>>   Some languages, such as Java, come with standard libraries for drawing
>> graphics
> 
> But using it is still nowhere near the level of "plot a pixel here please".

I've written a few graphics apps in Java. I eventually wrote a (very 
simple) image-screen class which I could plot to pixel by pixel, then 
dump to the window when I wanted an update. Much easier than piddling 
around with the AWT!

But you're right, I still had to plumb that into some window container 
or whatever it was.

>>> (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!)

Those were indeed the days. Interpreted BASIC, where you could type that 
directly into the command prompt and see the dot appear on the other 
side of the screen.... *sighs*


Post a reply to this message

From: Kevin Wampler
Subject: Re: Learning C++
Date: 12 Dec 2008 13:54:52
Message: <4942b37c$1@news.povray.org>
Orchid XP v8 wrote:
> ...so it's "undecidable" because you can't always figure out the answer 
> in finite time?

Basically.

A (yes/no) problem is decidable if it's possible to write a program 
which will eventually answer the problem for any given input.  Your 
algorithm will only answer "yes" (ie there is a root), but will fail to 
ever give a "no" answer.

It's the same with the halting problem.  It's trivial to write a program 
which will tell if if another program eventually halts, but impossible 
to always determine when it won't.


Post a reply to this message

From: Kevin Wampler
Subject: Re: Learning C++
Date: 12 Dec 2008 14:15:26
Message: <4942b84e$1@news.povray.org>
Eero Ahonen wrote:
> Mike Raiford wrote:
>> Eero Ahonen wrote:
>>> I once made a Pong -clone with Pascal. It was very hard to beat the
>>> computer, since I saved memory and used the same variable for the Y-axis
>>> placement for computer player and the ball :).
>> Nice!
>>
> 
> Nobody even noticed anything. Couple of guys tested it and played for
> something like hour oslt and just told me that it's freaking hard :D.

That's awesome.


Post a reply to this message

From: Orchid XP v8
Subject: Re: Learning C++
Date: 12 Dec 2008 15:27:14
Message: <4942c922$1@news.povray.org>
> I've written a few graphics apps in Java. I eventually wrote a (very 
> simple) image-screen class which I could plot to pixel by pixel, then 
> dump to the window when I wanted an update. Much easier than piddling 
> around with the AWT!
> 
> But you're right, I still had to plumb that into some window container 
> or whatever it was.

Yeah, this is what I ended up doing too. For Java, and more recently for 
GTK. (GTK has strong support for vector graphics, but still no help if 
you want to do bitmapped stuff algorithmically.) I've yet to find a good 
way to handle displaying stuff on the screen so it responds to damage 
messages yet your main program still continues executing...

>>>> (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!)
> 
> Those were indeed the days. Interpreted BASIC, where you could type that 
> directly into the command prompt and see the dot appear on the other 
> side of the screen.... *sighs*

Even [gasp] POV-Ray isn't *that* easy...

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: clipka
Subject: Re: Learning C++
Date: 12 Dec 2008 19:15:01
Message: <web.4942fe58267f2ab07c822d860@news.povray.org>
Invisible <voi### [at] devnull> wrote:
> Warp wrote:
> ...and this is the reason why. Almost *no* languages have the capability
> to easily draw graphics these days.
>
> (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!)

How about C# in a .NET environment? Just have the wizard create a program
template for you, code your custon OnDraw() handler, and hey presto! There you
go.

Okay, it's not "plot 4, 7" but "gr.draw(...);", so a few characters more, but
nothing conceptually challenging. Except that there's no "plot", so you have to
draw small circles or boxes to produce a dot.


But I remember, back in the days when I was learning C, I had similar problems -
all the more since I didn't have the slightest clue about programming for
Windows GUI nor X-Window (I could have gotten access to both at the institute).
But I desperately wanted to code a Quake level mapper, and *needed* some good
graphics output.

Fortunately I happened to know a bit of PostScript coding then, so I ended up
using the laser printers for graphics output :) (Later I also used GhostScript
in order to not waste too much paper, but of course it never came close to the
quality of the A3 laser prints...)


> > 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

Seen it once. I guess it's not *too* difficult for an *experienced* programmer
to get into it, but fortunately there's no need to: Virtually all mainstream
programming languages come with a framework that is *way* easier to use.

The main problem with the Windows API is that it's C, and doesn't actually lend
itself to being driven by C++ programs, plus there's a lot of "bureaucratic"
overhead involved, which begs to be handled by a framework instead of the
application developer.

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

I've never seen the X APIs, but I imagine they're probably the same level of
complexity as the Microsoft APIs.


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: Learning C++
Date: 12 Dec 2008 19:58:24
Message: <494308b0@news.povray.org>
clipka wrote:
> I've never seen the X APIs, but I imagine they're probably the same level
> of complexity as the Microsoft APIs.

No they aren't. X doesn't provide any UI widgets as far as I know.

Most X example apps use only black and white, which makes me think using
more than two colors is an extra pain. That is because they the only colors
X guarantees that exist.


Post a reply to this message

From: Mueen Nawaz
Subject: Re: Learning C++
Date: 12 Dec 2008 20:08:54
Message: <49430b26$1@news.povray.org>
Darren New wrote:
> Thanks. Already downloaded it, haven't waded thru it very far. :-) I've
> been finding motivation a bit hard to come by lately.

	It may be a good book, but its examples are not exactly motivational
material.

-- 
Beware of quantum ducks.       Quark!     Quark!


                    /\  /\               /\  /
                   /  \/  \ u e e n     /  \/  a w a z
                       >>>>>>mue### [at] nawazorg<<<<<<
                                   anl


Post a reply to this message

From: Mueen Nawaz
Subject: Re: Learning C++
Date: 12 Dec 2008 20:15:49
Message: <49430cc5@news.povray.org>
Invisible wrote:
> ...and this is the reason why. Almost *no* languages have the capability
> to easily draw graphics these days.
> 
> (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!)

	I've heard good things about Pygame.

-- 
Beware of quantum ducks.       Quark!     Quark!


                    /\  /\               /\  /
                   /  \/  \ u e e n     /  \/  a w a z
                       >>>>>>mue### [at] nawazorg<<<<<<
                                   anl


Post a reply to this message

From: Darren New
Subject: Re: Learning C++
Date: 12 Dec 2008 20:25:16
Message: <49430efc$1@news.povray.org>
Nicolas Alvarez wrote:
> Most X example apps use only black and white, which makes me think using
> more than two colors is an extra pain. That is because they the only colors
> X guarantees that exist.

Last I looked, you not only have to know how many colors the screen 
supports, but you have to order the bytes and such in the same order as they 
are in the hardware. I.e., you query the X server for how many bits and in 
what order the colors are, then you have to give all colors in that form to 
the server. You have to convert the images yourself, put them in the right 
order with the right stride, etc.

Now, note that "last I looked", an 8-bit color card for a machine that could 
run UNIX was a thousand dollars or so, some 15 years ago, so take it with a 
grain or two.

-- 
   Darren New, San Diego CA, USA (PST)
   The NFL should go international. I'd pay to
   see the Detroit Lions vs the Roman Catholics.


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

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