For Programmers: Free Programming Magazines  


Home > Archive > PerlTk > June 2004 > Tk and 3d objects









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Tk and 3d objects
Roman M. Parparov

2004-06-25, 7:10 pm

Good time of the day,

I need to embed graphs (lines, polygons, curves) on 3d space
(oblique coordinate system preferred) within a frame of a Tk
application.

I studied Tk::Zinc as well as the chapter from O'Reilly PerlTk
book that is available online.

It seems that Tk::Zinc doesn't provide the interface to OpenGL
3d functions, and O'Reilly book doesn't offer solutions to
embedding the OpenGL applets within a frame, but rather in
a separate window. (I tried to apply a code similar to their
example, but it failed).

Am I wrong somewhere, and one of the above ways does work for
my case? And if I am right, which other solutions could you
recommend, aside from writing a manual 3d <-> 2d transformation
and plotting the 3d pictures on a canvas by myself?

Roman.

--
Roman M. Parparov - NASA EOSDIS project node at TAU technical manager.
Email: romm@empire.tau.ac.il http://www.nasa.proj.ac.il/
Phone/Fax: +972-(0)3-6405205 (work), +972-(0)51-34-18-34 (home)
----------------------------------------------------------------------
The economy depends about as much on economists as the weather does on
weather forecasters.
-- Jean-Paul Kauffmann
Heiko Klein

2004-06-25, 7:10 pm

I haven't tried it, but when I understand it correct, you can send the
window-id you want to use to openGL.

Since you seem to have read Mastering PerlTk, The OpenGL example has one
line:

glpOpenWindow(parent => hex($top->id), widht=>450, height => 450);

You should try using $frame->id instead of $top->id to embed it into a
self-defined frame, not a toplevel.

I haven't the OpenGL module installed, so I cannot test it easily. It
would be nice to hear if my understanding of X-Windows is correct, and
if this is working on MS-platforms, too.

Best regards,

Heiko

Roman M. Parparov wrote:
> Good time of the day,
>
> I need to embed graphs (lines, polygons, curves) on 3d space
> (oblique coordinate system preferred) within a frame of a Tk
> application.
>
> I studied Tk::Zinc as well as the chapter from O'Reilly PerlTk
> book that is available online.
>
> It seems that Tk::Zinc doesn't provide the interface to OpenGL
> 3d functions, and O'Reilly book doesn't offer solutions to
> embedding the OpenGL applets within a frame, but rather in
> a separate window. (I tried to apply a code similar to their
> example, but it failed).
>
> Am I wrong somewhere, and one of the above ways does work for
> my case? And if I am right, which other solutions could you
> recommend, aside from writing a manual 3d <-> 2d transformation
> and plotting the 3d pictures on a canvas by myself?
>
> Roman.
>


zentara

2004-06-25, 7:10 pm

On Thu, 24 Jun 2004 08:02:36 +0200, Heiko Klein <Heiko.Klein@gmx.net>
wrote:

>I haven't the OpenGL module installed, so I cannot test it easily. It
>would be nice to hear if my understanding of X-Windows is correct, and
>if this is working on MS-platforms, too.


I havn't been able to get the OpenGL module to install without error.
[color=darkred]

perl-SDL ( the perl port to the SDL library) does OpenGL pretty well.
There are some demos in the SDL_Perl_2.1.0 distribution, and it has a
little tutorial available.

Maybe you could insert the SDL into a window in a Tk widget.

--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com