Skip to content

Commit 487abc6

Browse files
committed
Add stub Web README
1 parent 43169ec commit 487abc6

File tree

3 files changed

+245
-3
lines changed

3 files changed

+245
-3
lines changed

1.10.SampleWeb/README.md

Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
Table of contents
2+
=================
3+
4+
* [Overview](#overview)
5+
* [Video](#video)
6+
* [Steps](#steps)
7+
8+
* [1.9.1. Create build directory](#step-build-dir)
9+
* [1.9.2. Launch CMake](#step-open-cmake)
10+
* [1.9.3. Specify build and source directories](#step-dirs)
11+
* [1.9.4. Configure osgNativeLib and OSG](#step-cfg)
12+
* [1.9.5. Generate Xcode project file](#step-generate)
13+
* [1.9.6. Build osgNativeLib and OSG](#step-build)
14+
* [1.9.7. Start a new Xcode project](#step-xcode)
15+
* [1.9.8. Select Single View Application](#step-single-view)
16+
* [1.9.9. Select Objective-C language](#step-objc)
17+
* [1.9.10. Finish project creation](#step-proj)
18+
* [1.9.11. Copy combined library](#step-copy-lib)
19+
* [1.9.12. Copy view controller and model](#step-copy)
20+
* [1.9.13. Add copied files to the project](#step-add)
21+
* [1.9.14. Select RenderVC as the main interface](#step-main)
22+
* [1.9.15. Reference osgNativeLib headers](#step-headers)
23+
* [1.9.16. Run the project](#step-run)
24+
25+
<a name="overview"/>
26+
27+
Overview
28+
========
29+
30+
This tutorial is part of [OpenSceneGraph cross-platform guide](http://github.com/OGStudio/openscenegraph-cross-platform-guide).
31+
32+
In this tutorial we build and run
33+
[sample OpenSceneGraph application](http://github.com/OGStudio/openscenegraph-cross-platform-guide-application)
34+
under Linux for Web. The application displays provided model with simple GLSL shaders.
35+
36+
**Note**: this tutorial requires
37+
* OpenSceneGraph model (see [1.1. Create a cube](../1.1.CreateCube))
38+
* OpenSceneGraph sources (see [1.2. Install OpenSceneGraph under Linux](../1.2.InstallUnderLinux))
39+
* sample OpenSceneGraph application sources (see [1.5. Build and run sample OpenSceneGraph application under Linux](../1.5.SampleUnderLinux))
40+
41+
<a name="video"/>
42+
43+
Video
44+
=====
45+
46+
[YouTube](todo) | [Download](readme/video.mp4)
47+
48+
Video depicts running and building sample OpenSceneGraph application
49+
for Web under Xubuntu 16.04.
50+
51+
<a name="steps"/>
52+
53+
Steps
54+
=====
55+
56+
**Note**: steps below use frames from the video as screenshots.
57+
Watch the video to see all details.
58+
59+
<a name="step-build-dir"/>
60+
61+
1.9.1. Create build directory
62+
-----------------------------
63+
64+
![Screenshot](readme/f021.png)
65+
66+
Create build directory for iOS simulator build of osgNativeLib,
67+
a native C++ library to be used in Objective-C.
68+
69+
osgNativeLib also builds OpenSceneGraph inside
70+
`/path/to/openscenegraph-cross-platform-guide-application/../OpenSceneGraph/build/Simulator`.
71+
72+
**Note**: iOS simulator build only works under iOS simulator. If you need
73+
to build for a real device, you need to build osgNativeLib
74+
with `BUILD_SIMULATOR=NO` in a separate directory. In such a case
75+
OpenSceneGraph is built inside
76+
`/path/to/openscenegraph-cross-platform-guide-application/../OpenSceneGraph/build/Device`.
77+
78+
<a name="step-open-cmake"/>
79+
80+
1.9.2. Launch CMake
81+
-------------------
82+
83+
![Screenshot](readme/f033.png)
84+
85+
Open CMake
86+
87+
<a name="step-dirs"/>
88+
89+
1.9.3. Specify build and source directories
90+
-------------------------------------------
91+
92+
![Screenshot](readme/f068.png)
93+
94+
Specify build and source directories.
95+
96+
<a name="step-cfg"/>
97+
98+
1.9.4. Configure osgNativeLib and OSG
99+
-------------------------------------
100+
101+
![Screenshot](readme/f083.png)
102+
103+
Press `Configure`. Select `Xcode` generator when prompted.
104+
105+
<a name="step-generate"/>
106+
107+
1.9.5. Generate Xcode project file
108+
-----------------------------------
109+
110+
![Screenshot](readme/f145.png)
111+
112+
Press `Generate` to generate Xcode specific project file.
113+
114+
<a name="step-build"/>
115+
116+
1.9.6. Build osgNativeLib and OSG
117+
---------------------------------
118+
119+
![Screenshot](readme/f180.png)
120+
121+
Build osgNativeLib and OpenSceneGraph with the following commands:
122+
123+
`cd /path/to/build/dir`
124+
125+
`xcodebuild -IDEBuildOperationMaxNumberOfConcurrentCompileTasks=8 -configuration Release`
126+
127+
At the end the build process combines osgNativeLib and several OpenSceneGraph
128+
libraries into single `libosglib.a` library. This is done for convenience.
129+
130+
<a name="step-xcode"/>
131+
132+
1.9.7. Start a new Xcode project
133+
--------------------------------
134+
135+
![Screenshot](readme/f233.png)
136+
137+
Start a new Xcode project.
138+
139+
<a name="step-single-view"/>
140+
141+
1.9.8. Select Single View Application
142+
--------------------------------
143+
144+
![Screenshot](readme/f250.png)
145+
146+
Select Single View Application.
147+
148+
<a name="step-objc"/>
149+
150+
1.9.9. Select Objective-C language
151+
----------------------------------
152+
153+
![Screenshot](readme/f280.png)
154+
155+
Select Objective-C language and provide application specific
156+
information like title, organization, etc.
157+
158+
<a name="step-proj"/>
159+
160+
1.9.10. Finish project creation
161+
-------------------------------
162+
163+
![Screenshot](readme/f299.png)
164+
165+
Select project directory and finish project creation.
166+
167+
<a name="step-copy-lib"/>
168+
169+
1.9.11. Copy combined library
170+
-----------------------------
171+
172+
![Screenshot](readme/f330.png)
173+
174+
Copy combined library into project directory with the following command:
175+
176+
`cp /path/to/build/dir/libosglib.a /path/to/xcode/project/subdir/`
177+
178+
<a name="step-copy"/>
179+
180+
1.9.12. Copy view controller and model
181+
--------------------------------------
182+
183+
![Screenshot](readme/f365.png)
184+
185+
Copy view controller and model with the following command:
186+
187+
`cp -R /path/to/openscenegraph-cross-platform-guide-application/ios/project/* /path/to/xcode/project/subdir`
188+
189+
Sample OpenSceneGraph application's *ios/project* directory contains
190+
a box model and `RenderVC`. `RenderVC` is a view controller that renders
191+
the model with osgNativeLib.
192+
193+
<a name="step-add"/>
194+
195+
1.9.13. Add copied files to the project
196+
---------------------------------------
197+
198+
![Screenshot](readme/f382.png)
199+
200+
For Xcode to see the files, they should be added to the project.
201+
202+
<a name="step-main"/>
203+
204+
1.9.14. Select RenderVC as the main interface
205+
---------------------------------------------
206+
207+
![Screenshot](readme/f396.png)
208+
209+
Go to `General` project page and select `RenderVC.storyboard` as
210+
the main interface.
211+
212+
<a name="step-headers"/>
213+
214+
1.9.15. Reference osgNativeLib headers
215+
--------------------------------------
216+
217+
![Screenshot](readme/f456.png)
218+
219+
Since we have not added osgNativeLib headers to the project, we should
220+
reference them to be able to call osgNativeLib functions.
221+
222+
Go to project's `Build Settings`, find `Header Search Paths` section,
223+
then add the following search paths:
224+
225+
`/path/to/openscenegraph-cross-platform-guide-application/ios/src`
226+
227+
`/path/to/openscenegraph-cross-platform-guide-application/ios/src-gen`
228+
229+
<a name="step-run"/>
230+
231+
1.9.16. Run the project
232+
-----------------------
233+
234+
![Screenshot](readme/f527.png)
235+
236+
Select iPhone simulator and run the project.
237+
You should see red cube displayed.
238+

1.9.SampleUnderIOS/README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ Table of contents
2121
* [1.9.15. Reference osgNativeLib headers](#step-headers)
2222
* [1.9.16. Run the project](#step-run)
2323

24-
* Launch application
25-
26-
2724
<a name="overview"/>
2825

2926
Overview

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Table of contents
1313
* [1.7. Build and run sample OpenSceneGraph application under macOS](#tutorials-sample-macos)
1414
* [1.8. Build and run sample OpenSceneGraph application under Android](#tutorials-sample-android)
1515
* [1.9. Build and run sample OpenSceneGraph application under iOS](#tutorials-sample-ios)
16+
* [1.10. Build and run sample OpenSceneGraph application in Web](#tutorials-sample-web)
1617

1718
<a name="overview"/>
1819

@@ -130,3 +131,9 @@ Tutorials
130131

131132
Build and run sample OpenSceneGraph application under iOS.
132133

134+
### [1.10. Build and run sample OpenSceneGraph application in Web](1.10.SampleWeb)
135+
136+
![Screenshot](readme/1.10.sample_web.png)
137+
138+
Build and run sample OpenSceneGraph application in Web.
139+

0 commit comments

Comments
 (0)