Giter Site home page Giter Site logo

webglbook's Introduction

WebGLBook

Code Examples for Tony Parisi's Book, WebGL Up and Running.

You can grab the stable version that corresponds with August 2012 release of the book by getting the tag v1.0 (see Tags).

Please note that currently these examples are based on an older version of Three.js (r46). A snapshot of that version is included as libs/Three.js. I am currently working on upgrading to the latest stable Three.js (r50). Thanks for your patience!

VERY IMPORTANT TECH NOTE: It seems that folks are missing my little tech tip at the bottom of page 19, in the section titled "Setting up Three.js." These examples must be run from a web server such as Apache. localhost:// is fine but it needs to be coming from a server or loading external files such as textures and JSON for models simply won't work because of browser security restrictions. Or, if you have Python installed on your machine, you can run the simple web server module and serve up files that way:

cd <path to the example files>

python -m SimpleHTTPServer

Then point your web browser at

http://localhost:8000/

Happy coding!

webglbook's People

Contributors

szemek avatar tparisi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webglbook's Issues

Code updates?

Code examples are written to Three.js r46, as of July 2017 the current version of Three is r86.

I understand concepts are the same but code and technical examples are simply broken. Is there any plan to update?

earth-shader.js - Does not render ShaderMaterial()

After updating my Sim.js with the objectIntersects() method call, I was able to get earth-lit.js to work, however, the next example, earth-shader.js, does not render properly. Using the custom ShaderMaterial(), it only renders the clouds. When I switch that chunk of code for a MeshPhongMaterial() as coded in earth-lit.js, I'm able to render the earth surface, of course without specularity and bump map. Something is wrong with the ShaderMaterial() setup.
earth-shader js_clouds

stars.js - THREE.Vertex has been deprecated, use THREE.Vector3 instead

stars.js throws error to the console "THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead."

Still haven't gotten it to show the stars...

Probably want to just change:

starsGeometry.vertices.push( new THREE.Vertex( vector ) ) ;

to:

starsGeometry.vertices.push( vector );

since vector is already a Vector3 object.

Update sim.js

There were some updates on three.js and SIM.js is not working properly. The main problem is comming form the intersectScene which is now replaced with intersectObjects and some slight modifications are required

sim.js: update()-function defined twice

In the sim.js lib at line 462-465 you have this function definition for Sim.Object

Sim.Object.prototype.update = function()
{
this.updateChildren();
}

Later in line 505 this function definition starts defining Sim.Object.prototype.update a second time

Sim.Object.prototype.update = function()
{
var i, len;
len = this.children.length;
for (i = 0; i < len; i++)
{
    this.children[i].update();
}
}

I guess the first definition gets overwritten and so the first definition simple gets ignored and so no errors derive. updateChildren() is nowhere defined.

This could be cleaned up in a later revision.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.