-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
102 additions
and
228 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,31 @@ | ||
# Developer Guide | ||
# Development Environment | ||
|
||
Welcome to the luma.gl developer guide. | ||
To get started developing luma.gl, first make sure to install all dependancies from the repository root: | ||
|
||
`yarn bootstrap` | ||
|
||
## Additional Information Sources | ||
luma.gl's source code is in the `modules/` directory. Development is most easily done by running the examples in development mode, e.g.: | ||
|
||
* [WebGL2 Fundamentals](https://webgl2fundamentals.org/) - luma.gl is essentially a set of WebGL2 components, so the more you know about WebGL2 the better. This site is a great place to start reading. | ||
* [WebGL Insights](http://webglinsights.com/) - This classic WebGL book is now available as a free PDF download! | ||
``` | ||
cd examples/core/instancing | ||
yarn | ||
yarn start-local | ||
``` | ||
|
||
Any modifications made to the source or example code will cause the example to rebuild and the page to refresh, making quick iterations on code changes straightforward. | ||
|
||
Testing against the full website can be done by running `yarn start` in the the `website/`. This full website take longer to build but makes it easier to test against all examples. This can be helpful when making core changes to luma.gl. As with running the examples in development mode, a rebuild and page refresh will be triggered whenever source or website code is updated. | ||
|
||
|
||
## Testing | ||
|
||
Testing is performed on Travis CI and using a precommit hook. Local testing is supported on these environments: | ||
|
||
* `yarn test` - runs tests under node using headless.gl and a headless Chrome instance (using [SwiftShader](https://github.com/google/swiftshader)). | ||
* `yarn test browser` - Tests in your browser, may be helpful to quickly debug test case failures since it autoreloads on changes and gives you full access to your browser's debugger. | ||
|
||
When adding new features, please add relevant unit tests to the `test/` directory in the relevant module. | ||
|
||
### Helpful Hints | ||
- To only run one test from the suite for debugging purposes, change a call to `test` in the relevant spec to `test.only`. Remember to change this back before committing! | ||
- If a test fails in `headless`, but not in the browser, it's likely due to a difference in the contexts created (WebGL 1 versus 2), or the extensions available. Running in a browser without WebGL 2 support (e.g. Safari), might help narrow the issue down. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,40 @@ | ||
# Getting Started | ||
|
||
Welcome to luma.gl! | ||
To use luma.gl in an application, simply install it using `yarn`: | ||
|
||
This section has information about: | ||
``` | ||
yarn add luma.gl | ||
``` | ||
|
||
Note: While we'll use `yarn` for these instructions, as it's the tool we use for development, `npm` can be used as a drop-in substitute in most cases. A map of `npm` instructions to `yarn` is available [here](https://yarnpkg.com/lang/en/docs/migrating-from-npm/). | ||
|
||
## Using with Node.js | ||
|
||
luma.gl is built to run using [headless-gl](https://www.npmjs.com/package/gl) under Node.js, which can be extremely useful for unit testing. It is important to note that `headless-gl` only supports WebGL 1 and few extensions, so not all of luma.gl's features will be available. | ||
|
||
Use `yarn install gl` to install `headless-gl`. luma.gl will automatically use it when running under Node.js. You can then create a context using the `createGLContext` context function. | ||
|
||
```js | ||
import 'luma.gl'; | ||
import {createGLContext, Model, ...} from '@luma.gl/core'; | ||
const gl = createGLContext({width, height, ...}); | ||
``` | ||
|
||
## Interoperation with Other WebGL Applications | ||
|
||
luma.gl is build to interoperate cleanly with other WebGL applications using the same WebGL context. This is critical in geospatial applications, where `luma.gl` is often rendering over a base map drawn by another application. | ||
|
||
The key to luma.gl's interoperability is careful state management. luma.gl will track GL context changes and restore them after operations are complete. | ||
|
||
|
||
## Using luma.gl in Isorender Applications | ||
|
||
luma.gl is designed to support isorender application, i.e. the library can be loaded without problems under Node.js, as long as the application doesn't actually try to use WebGL (i.e. create WebGL contexts). However when luma.gl discovers that headless gl is not available it tries to give a helpful message explaining the situation. This can safely be ignored. | ||
|
||
Remember that you **can** actually create WebGL contexts under Node.js, as long as the headless `gl` is installed in your `node_modules` directory. More information on [using luma.gl with Node.js](/docs/get-started/using-with-node.md). | ||
|
||
|
||
## FAQ | ||
|
||
We occasionally mark github issues that contain answers to questions that pop up repeatedly with the [`FAQ` label](https://github.com/uber/luma.gl/issues?utf8=%E2%9C%93&q=label%3AFAQ+). | ||
|
||
* how to install luma.gl | ||
* how to run, copy, and modify the many luma.gl examples | ||
* How to use luma.gl with other frameworks in different environments. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,27 @@ | ||
# Examples | ||
|
||
luma.gl contains a suite of examples that showcase various features of the framework. If you are curious to see what can be achieved by luma.gl, you are welcome to check out the live demos at [luma.gl's website](http://uber.github.io/luma.gl/#/examples/overview). | ||
|
||
If you'd like to poke around the example code and use the examples to learn how to develop using luma.gl, you can build and run the examples yourself using the instructions below. | ||
|
||
luma.gl's suite of examples are an excellent way to learn how to use the API. They're the same examples showcased on the [website](http://uber.github.io/luma.gl/#/examples/overview), but can be run and edited individually. | ||
|
||
## Running Examples | ||
|
||
If you'd like to poke around the example code and use them to learn how to develop using luma.gl, you can build and run the examples yourself, following the instruction below: | ||
|
||
To run the examples, go to their directories, install and start, e.g: | ||
|
||
``` | ||
cd examples/core/instancing | ||
yarn # or npm install | ||
yarn start # or npm start | ||
yarn | ||
yarn start | ||
``` | ||
|
||
## Using the Latest Release Branch | ||
|
||
Note that luma.gl development happens on the `master` branch. While the goal is to always keep examples on `master` in working condition, they can temporarly be broken due to the core code being refactored for the next release. If you run into issues, or just want to be sure that you are running the latest stable version of the examples, just check out the latest release branch (e.g. `6.0-release`), and re-install and run the examples. | ||
|
||
To see available release branches: | ||
|
||
``` | ||
git branch | grep -release | ||
``` | ||
|
||
To check out a release branch: | ||
|
||
``` | ||
git checkout 6.0-release | ||
``` | ||
|
||
To go back to master: | ||
|
||
``` | ||
git checkout master | ||
``` | ||
|
||
|
||
## Copying Examples | ||
|
||
The examples are designed to be stand-alone so that they can be copied out of this repository, enabling you to use the examples as a basis for your own applications. | ||
|
||
Note: You can delete the last line in the webpack config file. That line handles the case of building the examples against the local luma.gl source (see "Development Mode" below), which is no longer applicable once the examples have been copied out of the repository. | ||
This will start a local development server and open the page in your browser. The example code will be in `app.js` in the example directly will automatically refresh the page. | ||
|
||
## Using the Latest Release Branch | ||
|
||
## Development Mode | ||
Note that luma.gl's `master` branch is its development branch and is often in flux. To ensure you're working with stable code, simply check out one of the release branches, e.g. | ||
|
||
Note that the `npm start` script in the example folders will use a published version of the luma.gl library (installed from npmjs.org) when bundling the code. | ||
`git checkout 7.0-release` | ||
|
||
To run the examples against the local luma.gl source code (useful for development and testing of luma.gl itself), use the `npm run start-local` command in the examples. | ||
To see all available release branches: | ||
|
||
``` | ||
cd examples/core/instancing | ||
yarn # or npm install | ||
yarn start-local # or npm run start-local | ||
git branch | grep -release | ||
``` |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.