hello
i have tried the example in "mastering perl/tk" book chapter 15 about embedding opengl in tk window as in the following code:
#!/usr/local/bin/perl # Embedding OpenGL in a Tk Toplevel. use Tk; use OpenGL; $mw = MainWindow->new; $mw->Button(-text => 'OpenGL Demo', -command => \&opengl)->pack; $mw->Button(-text => 'Quit', -command => \&exit)->pack; sub opengl { $top = $mw->Toplevel(qw/-width 500 -height 500 -background pink/); $top->title('OpenGL Demo'); $top->waitVisibility; glpOpenWindow(parent=> hex($top->id), width => 450, height => 450); glClearColor(0, 0, 1, 1); glClear(GL_COLOR_BUFFER_BIT); glOrtho(-1, 1, -1, 1, -1, 1); glColor3f(0, 1, 0); glBegin(GL_POLYGON); $pi = 3.141592654; $d2r = $pi / 180.0; $nvert = 8; $dangle = 360 / $nvert; for ($angle = 0; $angle <= 359; $angle += $dangle) { $x = cos($angle * $d2r); $y = sin($angle * $d2r); glVertex2f($x, $y); } glEnd; glFlush; } MainLoop;
it is supposed to draw a polygon, but i get just a cleared window, and in the dos console there is an error message like this picture:
http://sites.google.com/site/zak31415/Home/tkOpenglErr.JPG
C:\temp>perl opengl1
Tk::Error: Can't locate auto/OpenGL/glpcOpenWin.al in @INC (@INC contains: c:/perl/site/lib c:/perl/lib .) at opengl1 line 16
Carp::croak at c:/perl/lib/Carp.pm line 44
AutoLoader::AUTOLOAD at c:/perl/lib/AutoLoader.pm line 47
OpenGL::glpOpenWindow at c:/perl/site/lib/OpenGL.pm line 6049
main::opengl at opengl1 line 16
Tk callback for .button
Tk::__ANON__ at c:/perl/site/lib/Tk.pm line 250
Tk::Button::butUp at c:/perl/site/lib/Tk/Button.pm line 175
<ButtonRelease-1>
(command bound to event)
also the tk_demo in the opengl package from cpan give me the same error.
i am running windows xp
i have activestate perl 5.10 with tk version 804.028 from:
http://cpan.uwinnipeg.ca/PPMPackages/10xx/
and opengl 0.56 from:
http://www.bribes.org/perl/ppmdir.html and it is automatically will install FreeGLUT package
any ideas.
thank you

In reply to perl/TK and OpenGL by orange

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.