forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Instructions.rtf
184 lines (152 loc) · 10.7 KB
/
Instructions.rtf
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
{\rtf1\ansi\ansicpg1252\cocoartf1561\cocoasubrtf610
\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
\margl1440\margr1440\vieww21440\viewh21120\viewkind0
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\f0\fs38 \cf0 SimpleCocoaVTK 4.1\
2020-04-03\
by: Sean McBride and Mike Jackson\
\fs34 \
\ul Pre-Requisites:\
\ulnone \
1) you need Mac OS X 10.11.5 or later\
2) you need Xcode 8.0 or later.\
3) you need to know the basics of Xcode, CMake, VTK, and Cocoa already.\
4) you have to build VTK separately. The Xcode project expects VTK to be built with certain options, see below.\
\
\ul Purpose of Example:\
\ulnone \
This sample project shows how to use VTK in a Mac-only Xcode-based Cocoa application.\
\
This example is an NSDocument-based application with a single NSWindowController. The window has 3 independent VTK views in the XIB. They each illustrate a few different things:\
- left view: a vtkCocoaGLView showing a cone. Uses setWantsBestResolutionOpenGLSurface:YES (high resolution on Retina).\
- middle view: a vtkCocoaGLView showing a cylinder. Uses setWantsBestResolutionOpenGLSurface:NO (low resolution on Retina).\
- right view: a custom NSView subclass that uses a custom CAOpenGLLayer subclass to draw. It also has code showing how to deal with the window moving from a Retina to a non-Retina display. Note however that this NSView subclass has no code to handle mouse or keyboard events.\
\
See the screenshot (in the same folder as this file) to see what the app looks like.\
\
\ul Instructions:\
\ulnone \
First, you need to build VTK. SimpleCocoaVTK requires that you build VTK with the following non-default options:\
BUILD_SHARED_LIBS OFF \
CMAKE_BUILD_TYPE Debug \
VTK_VERSIONED_INSTALL OFF\
\
It is recommended to also use these options, and you should synchronize your choices with the SimpleCocoaVTK.xcconfig file: CMAKE_OSX_ARCHITECTURES (as desired)\
CMAKE_OSX_SYSROOT (as desired)\
CMAKE_OSX_DEPLOYMENT_TARGET (as desired)\
\
The other settings are not so relevant or their defaults are fine. If you've never built VTK before, please see Ryan Glover's excellent (though dated now) document here: <{\field{\*\fldinst{HYPERLINK "http://www.vtk.org/Wiki/Cocoa_VTK"}}{\fldrslt http://www.vtk.org/Wiki/Cocoa_VTK}}>. Make sure you both build and install VTK!\
\
Next, you have to create two "Custom Paths" in Xcode, named "vtk-debug-include" and "vtk-debug-lib". Do this from Preferences > Locations > Custom Paths (or Preferences > Locations > Source Trees in older versions of Xcode). Both should point to subfolders of where your installed VTK is. If you install into the default /usr/local/, set them like so:\
\
vtk-debug-include /usr/local/include/vtk\
vtk-debug-lib /usr/local/lib\
\
Note that the path changes depending on your version of VTK. Basically, you want the source trees to match your CMAKE_INSTALL_PREFIX setting.\
\
All the VTK files in the Xcode project are referenced relative to the 'custom paths'. This allows you to have your VTK files anywhere without changing the Xcode project itself. If files appear in red in Xcode, it's probably because your 'custom paths' are missing or wrong.\
\
Now you should be able to build the project!\
\
The code has many comments, and hopefully they will answer any questions you may have.\
\
If you have any problems, please post to the VTK Discourse forum.\
<{\field{\*\fldinst{HYPERLINK "https://discourse.vtk.org"}}{\fldrslt https://discourse.vtk.org}}>\
\
\ul \ulc0 Version History:\
\ulnone \
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i \cf0 Changes in 4.1 (since 4.0)\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i0 \cf0 - Build with VTK_VERSIONED_INSTALL=OFF to keep version numbers out of paths.\
- Updated for VTK 9.0, notably added libvtkRenderingUI.a to the Xcode project.\
- Use Cocoa Auto Layout so window resizes nicely.\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i \cf0 \
Changes in 4.0 (since 3.2)\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i0 \cf0 - Added a CAOpenGLLayer based example.\
- Show how to handle the window moving from a Retina to non-Retina display.\
- Use more modern Objective-C (@property, nullable).\
- Upgraded xib files to Xcode 8 format.\
\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i \cf0 Changes in 3.2 (since 3.1)\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i0 \cf0 - Updated for VTK 9.\
\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i \cf0 Changes in 3.1 (since 3.0)\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i0 \cf0 - Now demonstrate using setWantsBestResolutionOpenGLSurface:YES/NO on Retina displays.\
- Now demonstrate getting the macOS system font to render non-ASCII text with.\
\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i \cf0 Changes in 3.0 (since 2.0)\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i0 \cf0 - Now require newer Xcode and more modern Objective-C dialect.\
- Now require building VTK with VTK_CUSTOM_LIBRARY_SUFFIX=<empty string>, which is best practice anyway if using Xcode, so that the CMake-built VTK libraries don't constantly change filenames (by having the version number embedded).\
- Added a window controller class, which is more idiomatic.\
- The example now uses ARC (automatic reference counting) memory management by default. (This doesn't mean VTK needs to compiled as ARC, indeed, it cannot yet be.)\
\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i \cf0 Changes in 2.0 (since 1.9)\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i0 \cf0 - updated for VTK 7.1.\
\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i \cf0 Changes in 1.9 (since 1.8)\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i0 \cf0 - updated for VTK 6.3.\
\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i \cf0 Changes in 1.8 (since 1.7)\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i0 \cf0 - updated for VTK 6 and 10.7+ / Xcode 4+.\
\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i \cf0 Changes in 1.7 (since 1.6)\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i0 \cf0 - this example can now be built by CMake.\
\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i \cf0 Changes in 1.6 (since 1.5)\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i0 \cf0 - converted all nibs to xibs.\
- the Xcode project had a reference to a path on my disk, removed.\
\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i \cf0 Changes in 1.5 (since 1.4)\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i0 \cf0 - now use two source trees instead of one.\
- updated example to better reflect current versions of VTK, Mac OS, and Xcode.\
\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i \cf0 Changes in 1.4 (since 1.3)\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i0 \cf0 - removed prefix file\
- renamed main.m to main.mm\
- converted tabs to spaces\
\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i \cf0 Changes in 1.3 (since 1.2)\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i0 \cf0 - switched to using just one Source Tree\
- tested in Mac OS X 10.5 and Xcode 3\
- improved these instructions\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i \cf0 \
Changes in 1.2 (since 1.1)\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i0 \cf0 - using smart pointers\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i \cf0 \
Changes in 1.1 (since 1.0)\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\tx7380\tx7940\tx8520\pardirnatural\partightenfactor0
\i0 \cf0 - fixed some memory leaks\
- minor code cleanup\
- added call to print out any leaking vtk objects\
- linked to Ryan Glover's great instructions on how to build vtk\
}