diff options
author | Timothy Pearson <[email protected]> | 2012-01-01 18:24:37 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2012-01-01 18:24:37 -0600 |
commit | 4e997a9c6e25689dca65a2ec573a599699ef8170 (patch) | |
tree | fdb5ecac42fb8204df9fc8c9abe1c784d4719e0e /PerlQt/examples/opengl | |
parent | bfa107694b2507a7116f8856cafe4ab1375da8a9 (diff) | |
download | libtqt-perl-4e997a9c6e25689dca65a2ec573a599699ef8170.tar.gz libtqt-perl-4e997a9c6e25689dca65a2ec573a599699ef8170.zip |
Initial TQt conversion
Diffstat (limited to 'PerlQt/examples/opengl')
-rw-r--r-- | PerlQt/examples/opengl/README | 4 | ||||
-rw-r--r-- | PerlQt/examples/opengl/box/GLBox.pm | 14 | ||||
-rw-r--r-- | PerlQt/examples/opengl/box/glbox | 46 | ||||
-rw-r--r-- | PerlQt/examples/opengl/gear/gear | 26 |
4 files changed, 45 insertions, 45 deletions
diff --git a/PerlQt/examples/opengl/README b/PerlQt/examples/opengl/README index 5c93086..7e2f174 100644 --- a/PerlQt/examples/opengl/README +++ b/PerlQt/examples/opengl/README @@ -3,9 +3,9 @@ the OpenGL module available on CPAN (http://www.cpan.org) Latest version is 0.54, as of 09/11/02 -Both Smoke and Qt must also have been compiled with OpenGL support. +Both Smoke and TQt must also have been compiled with OpenGL support. -If your Qt library has OpenGL support but PerlQt complains about lacking +If your TQt library has OpenGL support but PerlTQt complains about lacking methods or classes, check ./configure's config.log file for any error that might have occured while detecting your OpenGL settings. diff --git a/PerlQt/examples/opengl/box/GLBox.pm b/PerlQt/examples/opengl/box/GLBox.pm index dd6ceb9..1c6ceb8 100644 --- a/PerlQt/examples/opengl/box/GLBox.pm +++ b/PerlQt/examples/opengl/box/GLBox.pm @@ -4,13 +4,13 @@ use OpenGL qw(:all); use strict; -use Qt; -use Qt::isa qw(Qt::GLWidget); -use Qt::slots +use TQt; +use TQt::isa qw(TQt::GLWidget); +use TQt::slots setXRotation => ['int'], setYRotation => ['int'], setZRotation => ['int']; -use Qt::attributes qw( +use TQt::attributes qw( xRot yRot zRot @@ -75,7 +75,7 @@ sub makeObject glLineWidth( 2.0 ); - glBegin( GL_QUADS ); + glBegin( GL_TQUADS ); glVertex3f( 1.0, 0.5, -0.4 ); glVertex3f( 1.0, -0.5, -0.4 ); glVertex3f( -1.0, -0.5, -0.4 ); @@ -84,7 +84,7 @@ sub makeObject qglColor( &blue ); - glBegin( GL_QUADS ); + glBegin( GL_TQUADS ); glVertex3f( 1.0, 0.5, 0.4 ); glVertex3f( 1.0, -0.5, 0.4 ); glVertex3f( -1.0, -0.5, 0.4 ); @@ -93,7 +93,7 @@ sub makeObject qglColor( &darkRed ); - glBegin( GL_QUAD_STRIP ); + glBegin( GL_TQUAD_STRIP ); glVertex3f( 1.0, 0.5, -0.4 ); glVertex3f( 1.0, 0.5, 0.4 ); glVertex3f( 1.0, -0.5, -0.4 ); glVertex3f( 1.0, -0.5, 0.4 ); qglColor( &yellow ); diff --git a/PerlQt/examples/opengl/box/glbox b/PerlQt/examples/opengl/box/glbox index 613a274..fed74a3 100644 --- a/PerlQt/examples/opengl/box/glbox +++ b/PerlQt/examples/opengl/box/glbox @@ -3,9 +3,9 @@ package GLObjectWindow; use strict; -use Qt; -use Qt::isa qw(Qt::Widget); -use Qt::attributes qw( +use TQt; +use TQt::isa qw(TQt::Widget); +use TQt::attributes qw( file frame menu @@ -22,50 +22,50 @@ sub NEW shift->SUPER::NEW(@_); # Create a menu - file = Qt::PopupMenu( this ); - file->insertItem( "Exit", Qt::app(), SLOT 'quit()', Qt::KeySequence(int &CTRL + &Key_Q )); + file = TQt::PopupMenu( this ); + file->insertItem( "Exit", TQt::app(), TQT_SLOT 'quit()', TQt::KeySequence(int &CTRL + &Key_Q )); # Create a menu bar - menu = Qt::MenuBar( this ); - menu->setSeparator( &Qt::MenuBar::InWindowsStyle ); + menu = TQt::MenuBar( this ); + menu->setSeparator( &TQt::MenuBar::InWindowsStyle ); menu->insertItem("&File", file ); # Create a nice frame to put around the OpenGL widget - frame = Qt::Frame( this, "frame" ); - frame->setFrameStyle( &Qt::Frame::Sunken | &Qt::Frame::Panel ); + frame = TQt::Frame( this, "frame" ); + frame->setFrameStyle( &TQt::Frame::Sunken | &TQt::Frame::Panel ); frame->setLineWidth( 2 ); # Create our OpenGL widget box = GLBox( frame, "glbox"); # Create the three sliders; one for each rotation axis - xpos = Qt::Slider ( 0, 360, 60, 0, &Qt::Slider::Vertical, this, "xsl" ); - xpos->setTickmarks( &Qt::Slider::Left ); - Qt::Object::connect( xpos, SIGNAL 'valueChanged(int)', box, SLOT 'setXRotation(int)' ); + xpos = TQt::Slider ( 0, 360, 60, 0, &TQt::Slider::Vertical, this, "xsl" ); + xpos->setTickmarks( &TQt::Slider::Left ); + TQt::Object::connect( xpos, TQT_SIGNAL 'valueChanged(int)', box, TQT_SLOT 'setXRotation(int)' ); - ypos = Qt::Slider ( 0, 360, 60, 0, &Qt::Slider::Vertical, this, "ysl" ); - ypos->setTickmarks( &Qt::Slider::Left ); - Qt::Object::connect( ypos, SIGNAL 'valueChanged(int)', box, SLOT 'setYRotation(int)' ); + ypos = TQt::Slider ( 0, 360, 60, 0, &TQt::Slider::Vertical, this, "ysl" ); + ypos->setTickmarks( &TQt::Slider::Left ); + TQt::Object::connect( ypos, TQT_SIGNAL 'valueChanged(int)', box, TQT_SLOT 'setYRotation(int)' ); - zpos = Qt::Slider ( 0, 360, 60, 0, &Qt::Slider::Vertical, this, "zsl" ); - zpos->setTickmarks( &Qt::Slider::Left ); - Qt::Object::connect( zpos, SIGNAL 'valueChanged(int)', box, SLOT 'setZRotation(int)' ); + zpos = TQt::Slider ( 0, 360, 60, 0, &TQt::Slider::Vertical, this, "zsl" ); + zpos->setTickmarks( &TQt::Slider::Left ); + TQt::Object::connect( zpos, TQT_SIGNAL 'valueChanged(int)', box, TQT_SLOT 'setZRotation(int)' ); # Now that we have all the widgets, put them into a nice layout # Put the sliders on top of each other - my $vlayout = Qt::VBoxLayout( 20, "vlayout"); + my $vlayout = TQt::VBoxLayout( 20, "vlayout"); $vlayout->addWidget( xpos ); $vlayout->addWidget( ypos ); $vlayout->addWidget( zpos ); # Put the GL widget inside the frame - my $flayout = Qt::HBoxLayout( frame, 2, 2, "flayout"); + my $flayout = TQt::HBoxLayout( frame, 2, 2, "flayout"); $flayout->addWidget( box, 1 ); # Top level layout, puts the sliders to the left of the frame/GL widget - my $hlayout = Qt::HBoxLayout( this, 20, 20, "hlayout"); + my $hlayout = TQt::HBoxLayout( this, 20, 20, "hlayout"); $hlayout->setMenuBar( menu ); $hlayout->addLayout( $vlayout ); $hlayout->addWidget( frame, 1 ); @@ -75,10 +75,10 @@ sub NEW package main; -use Qt; +use TQt; use GLObjectWindow; -my $a = Qt::Application(\@ARGV); +my $a = TQt::Application(\@ARGV); my $w = GLObjectWindow; $w->resize(350,350); diff --git a/PerlQt/examples/opengl/gear/gear b/PerlQt/examples/opengl/gear/gear index 2edc951..d9e4c8a 100644 --- a/PerlQt/examples/opengl/gear/gear +++ b/PerlQt/examples/opengl/gear/gear @@ -2,7 +2,7 @@ # # Draws a gear. # -# This code is originally from Qt-1.44, by Troll Tech +# This code is originally from TQt-1.44, by Troll Tech # # Portions of this code have been borrowed from Brian Paul's Mesa # distribution. @@ -11,8 +11,8 @@ package GearWidget; use OpenGL qw(:all); -use Qt; -use Qt::attributes qw( +use TQt; +use TQt::attributes qw( gear1 gear2 gear3 @@ -22,7 +22,7 @@ use Qt::attributes qw( angle ); -use Qt::isa qw(Qt::GLWidget); +use TQt::isa qw(TQt::GLWidget); # # Draw a gear wheel. You'll probably want to call this function when @@ -54,7 +54,7 @@ sub gear { glNormal3f(0.0, 0.0, 1.0); # draw front face - glBegin(GL_QUAD_STRIP); + glBegin(GL_TQUAD_STRIP); for $i (0 .. $teeth) { $angle = $i * 2.0*$pi / $teeth; glVertex3f($r0*cos($angle), $r0*sin($angle), $width*0.5); @@ -65,7 +65,7 @@ sub gear { glEnd(); # draw front sides of teeth - glBegin(GL_QUADS); + glBegin(GL_TQUADS); $da = 2.0*$pi / $teeth / 4.0; for $i (0 .. $teeth-1) { $angle = $i * 2.0*$pi / $teeth; @@ -81,7 +81,7 @@ sub gear { glNormal3f(0.0, 0.0, -1.0); # draw back face - glBegin(GL_QUAD_STRIP); + glBegin(GL_TQUAD_STRIP); for $i (0 .. $teeth) { $angle = $i * 2.0*$pi / $teeth; glVertex3f($r1*cos($angle), $r1*sin($angle), -$width*0.5); @@ -92,7 +92,7 @@ sub gear { glEnd(); # draw back sides of teeth - glBegin(GL_QUADS); + glBegin(GL_TQUADS); $da = 2.0*$pi / $teeth / 4.0; for $i (0 .. $teeth-1) { $angle = $i * 2.0*$pi / $teeth; @@ -105,7 +105,7 @@ sub gear { glEnd(); # draw outward faces of teeth - glBegin(GL_QUAD_STRIP); + glBegin(GL_TQUAD_STRIP); for $i (0 .. $teeth-1) { $angle = $i * 2.0*$pi / $teeth; @@ -139,7 +139,7 @@ sub gear { glShadeModel(GL_SMOOTH); # draw inside radius cylinder - glBegin(GL_QUAD_STRIP); + glBegin(GL_TQUAD_STRIP); for $i (0 .. $teeth) { $angle = $i * 2.0*$pi / $teeth; glNormal3f(-cos($angle), -sin($angle), 0.0); @@ -251,12 +251,12 @@ sub timerEvent { package main; -use Qt; +use TQt; use GearWidget; -$app = Qt::Application(\@ARGV); +$app = TQt::Application(\@ARGV); -if(!Qt::GLFormat::hasOpenGL()) { +if(!TQt::GLFormat::hasOpenGL()) { warn("This system has no OpenGL support. Exiting."); exit -1; } |