newLISP for 3D/OpenGL with iVRS/TclTk

Guiserver, GTK-server, OpenGL, PostScript,
HTML 5, MIDI, IDE
Locked
HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

newLISP for 3D/OpenGL with iVRS/TclTk

Post by HPW »

With this code:

Code: Select all

(tk "load C:/tcl/bin/ivrs.dll VRS")

(tk "if {[winfo exists .dw] == 1} {destroy .dw}")
(tk "toplevel .dw -background lightblue")

;# camera settings
(tk "global mview; set mview [new SceneThing]")
(tk "global mview; $mview append [new Camera {0 3 2} {0 0 0}  60]")

;# main thing
(tk "global mscene mview; set mscene [new SceneThing $mview]")

;# thing with floor
(tk "global menviron mscene; set menviron [new SceneThing $mscene]")

;# lightsources 
(tk "global mscene; $mscene append [new DistantLight { -0.1 0 -1 } {1 1 1 1} 1.0 0.9]")
(tk "global mscene; $mscene append [new PointLight { 1 2 1 } {1 1 1 1} 1.0  0.8]")

;# thing with snowman
(tk "global msnowman mscene; set msnowman [new SceneThing $mscene]")

(tk "global mbody_ msnowman; set mbody_ [new SceneThing $msnowman]")
(tk "global mbody_ ;$mbody_ append [new ColorAttribute 1 1 1 ]")
(tk "global mbody_ ;$mbody_ append [new Scaling {1 0.9 1 }]")
(tk "global mbody_ ;$mbody_ append [new FaceStyle FaceStyle::Filled FaceStyle::Culled]")
(tk "global mbody_ ;$mbody_ append [new Sphere 0.5  {0 0.43 0}]")
(tk "global mbody_ ;$mbody_ append [new Sphere 0.35 {0 1.1 0}]")
(tk "global mbody_ ;$mbody_ append [new Sphere 0.25 {0 1.5 0}]")
(tk "global mbody_ ;$mbody_ append [new ColorAttribute { 0.7 0.7 1.0 1 }]")
(tk "global mbody_ ;$mbody_ append [new Box {-1 -0.08 -1 } { 1 0 1 }]")

(tk "global mface msnowman; set mface [new SceneThing $msnowman]")
(tk "global meyes_ mface; set meyes_ [new SceneThing $mface]")
(tk "global meyes_ ; $meyes_ append [new ColorAttribute 0.1 0.1 1.0]")
(tk "global meyes_ ; $meyes_ append [new Sphere 0.04  {-0.1 1.5 0.12}]")
(tk "global meyes_ ; $meyes_ append [new Sphere 0.04  { 0.1 1.5 0.12}]")

(tk "global mnose_ mface; set mnose_ [new SceneThing $mface]")
(tk "global mnose_ ; $mnose_ append [new ColorAttribute 1 0.5 0]")
(tk "global mnose_ ; $mnose_ append [new Cone {0 1.55 0.2} {0 1.35 0.22} 0.00  0.04]")

(tk "global mmouth_ mface; set mmouth_ [ new SceneThing $mface]")
(tk "global mmouth_ ; $mmouth_ append [new ColorAttribute 0.9 0.9 0]")
(tk "global mmouth_ ; $mmouth_ append [new Cylinder {-0.12 1.33 0.21} {.12 1.33 0.21}  0.05]")

;# store a few shapes so we can identify them later
(tk "global mbody_ ;[$mbody_ object 3]  setObjectName  {lower part}")
(tk "global mbody_ ;[$mbody_ object 4]  setObjectName  {middle part}")
(tk "global mbody_ ;[$mbody_ object 5]  setObjectName  {upper part}")
(tk "global mbody_ ;[$mbody_ object 7]  setObjectName  {box}")
(tk "global meyes_ ;[$meyes_ object 1]  setObjectName  {left eye}")
(tk "global meyes_ ;[$meyes_ object 2]  setObjectName  {right eye}")
(tk "global mnose_ ;[$mnose_ object 1]  setObjectName  {nose}")
(tk "global mmouth_ ;[$mmouth_ object 1]  setObjectName  {mouth}")

 
;# MENUS

(tk "frame .dw.mbar -border 1 -relief raised")
(tk "menubutton .dw.mbar.file -text File -menu .dw.mbar.file.m")

(tk "menu .dw.mbar.file.m")
(tk ".dw.mbar.file.m add command -label {quit} -command {destroy .; VRS cleanup}")
(tk "pack .dw.mbar.file -side left")
(tk "pack .dw.mbar -fill x")

;# build a 3D canvas
(tk "global canvas ;set canvas [ new TclCanvas .dw.toto 256  256 ]")
(tk "pack .dw.toto")

;# connect geometry graphs to the canvas
(tk "global canvas mview; $canvas append $mview")
(tk "global canvas mscene; $canvas append [new TrackBall $mscene]")

;# STATUS AREA
(tk "frame .dw.state -relief sunken -border 2")
(tk "global statustext; label .dw.state.msg -textvariable statustext -justify left -anchor w")
(tk "pack .dw.state -side bottom -fill x")
(tk "pack .dw.state.msg -side left -fill x")
I get this:
http://hpwickern.bei.t-online.de/anmeld ... sp_vrs.png

More info on: Virtual Rendering System here: http://www.vrs3d.org/

I like it!

(Code ported from sample-demos of iVRS)
Hans-Peter

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

Forgot to metion that in the iVRS distribution 1.08 (2.9 MB) is one DLL missing. I have got it by email from the developers. They will update the package. Those who can not wait, can drop me a mail.
Hans-Peter

Wandering
Posts: 4
Joined: Tue Aug 24, 2004 10:56 am

Could you help me with this

Post by Wandering »

I downloaded this and the code doesnt seem to work.
It says missing ivrs.dll even though i have given
the correct path.

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

The following files should be in Tcl's \bin path:

ivrs.dll
libmmd.dll
vrs_tcl.dll
vrs_vc60.dll

(The path is also in both enviroments path-variables!)

Your first test should be to double-click on snowman.tcl
in c:\Tcl\lib\vrs3.3\demos

This should show the snowman demo.

On latest test with ivrs3.3 I had problems with one XP-PC.
It crashes, but on my Home-XP it works.
So at least ivrs3.2 works for me on both PC.

So when the test on Standalone-TCL is passed then the newLISP version should work the same.
Hans-Peter

Wandering
Posts: 4
Joined: Tue Aug 24, 2004 10:56 am

Tcl snowman is working but lisp code isnt

Post by Wandering »

The tcl code is now working perfectly after i copied the dlls.
However when i paste your code in newlisp a new window
does pop up, but the internal of the window does not
render the opengl objects. It just appears to be stuck.

If i click within the stuck window it gives me an error
message saying Runtime error. This application has
requested the runtime to terminate it in an unusual way.

Any idea?
I am using windows 2000 and i do have Visual Studio 2002 installed
Help with this would be appreciated

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

Hmm, maybe a console-paste problem.
Paste the source first in a editor and save it as snowman.lsp
Then start a fresh newlisp-tk and load the source.
Give it a try.
Hans-Peter

Wandering
Posts: 4
Joined: Tue Aug 24, 2004 10:56 am

Tried that

Post by Wandering »

Doesnt work.

Lets see...........................

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

Did you download ivrs 1.09?
The base vrs 3.3 is declared as alpha.

The last stable release is 3.2 aka ivrs 1.08
There you must download 2 file (1 with the additional DLL)

That was my problem on my office pc.
It only works with the stable 3.2
You can install under parallel under \lib
Only the binary's in \bin has to be overwritten.

Maybe you should try that.
Hans-Peter

Wandering
Posts: 4
Joined: Tue Aug 24, 2004 10:56 am

Tried that and doesnt work

Post by Wandering »

I tried downloading the earlier version and same error.
One thing i wanted to ask was i am using
ActiveTCl. I hope that doesnt cause any issues

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

>i am using ActiveTCl. I hope that doesnt cause any issues

No, I do also use ActiveTcl 8.4.6

I have no idea, what the problem can be. When the Tcl file
work, you have a correct Tcl/Tk system.
The lisp-code wrapps only exactly the same code and pass
it to Tcl.
Hans-Peter

Locked