File: test4.p

package info (click to toggle)
libpdl-graphics-trid-perl 2.102-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 476 kB
  • sloc: perl: 5,082; ansic: 683; makefile: 8
file content (53 lines) | stat: -rw-r--r-- 1,043 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
use PDL;
use PDL::Graphics::TriD;
use PDL::Graphics::TriD::Image;
use PDL::IO::Pic;

$s = 10;
$k = zeroes($s,$s);

$x = $k->xvals();
random($k->inplace); $x += $k;

$y = $k->yvals();
random($k->inplace); $y += $k;

random($k->inplace);
$z = $k;

$x /= $s; $y /= $s; $z /= $s;

$pa = PDL::Graphics::TriD::Lattice->new([$x,$y,$z]);
$pb = PDL::Graphics::TriD::Points->new([$x,$y,$z+1]);

$win = PDL::Graphics::TriD::get_current_window();
$win->clear_objects();
$win->add_object($pa);
$win->add_object($pb);

$nx = zeroes(3,20);
$nc = zeroes(3,20);
random($nx->inplace);
random($nc->inplace);

use OpenGL qw(:all);
glShadeModel (&GL_SMOOTH);

$win->add_object(TOBJ->new);
$win->twiddle();

package TOBJ;
our @ISA; BEGIN { @ISA = qw/PDL::Graphics::TriD::Object/ }
use PDL::Graphics::OpenGLQ;

sub new {
	bless {},$_[0];
}

sub togl {
	OpenGL::glDisable(&OpenGL::GL_LIGHTING);
	PDL::gl_line_strip_col($::nx,$::nc);
	OpenGL::glColor3f(1,0,1);
	gl_texts(PDL->pdl(0,0,0.5), ["HELLO HELLO HELLO GLWORLD!!!"]);
	OpenGL::glEnable(&OpenGL::GL_LIGHTING);
}