TURTLE3D: another funny small program

TURTLE3D: another funny small program

Post by Hans B. Wiezor » Sun, 09 Jun 1991 02:11:12



this is another small prgram using the turtle3d library posted a few days ago.
it's just for showing, what can be done using a turtleoid approach to 3D
graphics. ;-)

have fun,

opus

-------- cut here ------ PYRA.PAS ---------- cut here --------

uses turtle3d;

const angle = 19.5;

procedure pyra(n : byte; l : real);
var i : byte;
begin
  if n>1 then begin
    pyra(n-1, l/2);
    fd(l/2);
    pyra(n-1, l/2);
    rt(120);
    fd(l/2);
    lt(120);
    pyra(n-1, l/2);
    rt(60);
    bk(l/2);
    rl(angle);
    up(60);
    fd(l/2);
    rl(90);
    lt(60);
    pyra(n-1, l/2);
    rt(60);
    rr(90);
    bk(l/2);
    dn(60);
    rr(angle);
    lt(60)
  end
  else begin
    for i := 1 to 3 do begin
      fd(l);
      rr(angle);
      up(120);
      fd(l);
      bk(l);
      dn(120);
      rl(angle);
      rt(120);
    end
  end
end;

begin
  init3d;
  penup;
  bk(135);
  rt(90);
  rl(90);
  bk(240);
  lt(90);
  bk(80);
  rt(45);
  rr(8);
  pendown;
  pyra(4, 440);  { increment first parameter for more complicated picture}
  readln
end.

-------- cut here ------ PYRA.PAS ---------- cut here --------

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
I                  __     I   Hans Bernhard Wiezorke  (at Uni. of Karlsruhe)  I


I          ------)    !   I- - - - - - - - - - - - - - - - - - - - - - - - - -I
I                X~~~~!   I   Always remember : WHEREVER YOU BE  --           I
I                         I                     THERE YOU ARE                 I
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 
 
 

1. a SMALL problem in a small program

Hello Friends,

I tried to compile HelloCone, but it can not work! Here is the error :

[COMPILE]
Compiling...
HelloCone.cpp
C:\C++ex\131201\HelloCone.cpp(41) : fatal error C1010: unexpected end
of file while looking for precompiled header directive
Error executing cl.exe.

HelloCone.obj - 1 error(s), 0 warning(s)
[/COMPILE]

Here is the source code. I wonder if I made sth. wrong when I set up
the project, Because the program has no error at all.

[CODE]

//#include "stdafx.h"
#include "iostream.h"
#include <C:\TGS\OIV2.5.2\include\Inventor\Xt\SoXt.h>
#include <C:\TGS\OIV2.5.2\include\Inventor\Xt\SoXtRenderArea.h>
#include <C:\TGS\OIV2.5.2\include\Inventor\nodes\SoCone.h>
#include <C:\TGS\OIV2.5.2\include\Inventor\nodes\SoDirectionalLight.h>
#include <C:\TGS\OIV2.5.2\include\Inventor\nodes\SoMaterial.h>
#include <C:\TGS\OIV2.5.2\include\Inventor\nodes\SoPerspectiveCamera.h>
#include <C:\TGS\OIV2.5.2\include\Inventor\nodes\SoSeparator.h>

main(int, char **argv)
{
Widget myWindow = SoXt::init(argv[0]);
if (myWindow == NULL) exit (1);

SoSeparator *root = new SoSeparator;
SoPerspectiveCamera *myCamera = new SoPerspectiveCamera;
SoMaterial *myMaterial = new SoMaterial;
root->ref();
root->addChild(myCamera);
root->addChild(new SoDirectionalLight);
myMaterial->diffuseColor.setValue (1.0, 0.0, 0.0);
root->addChild (myMaterial);
root->addChild (new SoCone);

SoXtRenderArea *myRenderArea = new SoXtRenderArea(myWindow);

myCamera->viewAll (root, myRenderArea->getViewportRegion());

myRenderArea->setSceneGraph(root);
myRenderArea->setTitle( "Hello World!");
myRenderArea->show();

SoXt::show(myWindow);
SoXt::mainLoop();

[/CODE]

Thanks a lot.
tony

2. Direct Hardware Access Questions....

3. a small problem in a small program

4. unwanted extra movement during rotation

5. best 3d program to create small 75X75 web graphics

6. Newbie Help!

7. Programs to smooth a small mesh?

8. Where can I find small tga2gif program..?

9. Small Slide Show program for jpgs?

10. a problem in a small program: HelloCone.java

11. small Mac Slide Show program?

12. Small program to handle Beziers