-
Notifications
You must be signed in to change notification settings - Fork 2
/
README
88 lines (59 loc) · 2.34 KB
/
README
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
INTRODUCTION
NuOpenGLCubeDemo is a simple example of using low-level
OpenGL in Nu to draw and animate a cube.
This demo calls older OpenGL primitives, and doesn't use
a modern OpenGL architecture. I wouldn't recommend
using this approach for real applications, but I was
mostly interested to see how much of the application
I could implement in Nu. It turns out that just about
everything could be implemented in Nu except for a 1-line
function at initialization. Nice job Tim and libffi!
You can have fun with the application using the Nu
Console. Here are a few things to try:
($view startAnimation)
($view stopAnimation)
($view resetCameraAndUpdateProjection)
You can experiment with changing the velocity and
acceleration vectors when animating the cube:
;; Use indexes 0,1,2 to explore
;; and set X/Y/Z parameters
($rVel valueAtIndex:0) ;; X velocity
($rVel setValue:0.5 atIndex:0)
($rAccel setValue:0.004 atIndex:0) ;; acceleration
You can also play with the camera settings like the
aperture, but not all of these setting have global
variables so you'll have to get at them using the
view:
(($view camera) setAperture:80.0)
When the main application view has the focus, you
can hit the space bar to toggle the animation on
and off.
Drag the cube around in real-time to rotate it.
Right-click and drag to pan the camera.
Option-click and drag (or use your scroll wheel,
if you have one) to move the dolly to zoom in and
out.
If you lose the cube while zooming and panning,
hit 'r' to reset the camera.
You can find the latest version of NuOpenGLCubeDemo at
http://github.com/itfrombit/nuopenglcubedemo
This application was adapted from Apple's Cocoa OpenGL
sample code. You can find the original version at
http://developer.apple.com/samplecode/CocoaGL/index.html
The shell of the Nu application was adapted from Tim
Burks' Benwanu example in the Nu distribution.
REQUIREMENTS
NuOpenGLCubeDemo requires Nu, nuke and the Apple
Developer Tools. It was written and tested on
OS X 10.5.2.
You can find out more about Nu at
http://programming.nu
You can get Nu from the git repository at
http://github.com/timburks/nu
INSTALLATION
Build the NuOpenGLCubeDemo by typing "nuke" in the
top-level NuOpenGLCubeDemo directory. You can run
the resulting application from the same top-level
directory.
AUTHOR
NuOpenGLCubeDemo was written by Jeff Buck.