Canvas 3d JS Library

WebGL made easy!
  • rss
  • What is C3DL?
  • Download
  • Tutorials
    • Tutorial #1: WebGL Browsers
    • Tutorial #2: A simple scene
    • Tutorial #3: Callback
    • Tutorial #4: Models
    • Tutorial #5: Light effects
    • Tutorial #6: Picking
    • Tutorial #7: Materials
    • Tutorial #8: Particle Systems
    • Tutorial #9: Camera Basics
    • Tutorial #10: Advanced FreeCamera
    • Tutorial #11: OrbitCamera
    • Tutorial #12: Advanced Camera Functions
  • Development News
  • Documentation
  • Community
  • Resources
  • Contact
  • About

instanceof issues

Andor Salga | 18 October, 2009 | 11:58
When I first started work on porting the C3DL library from using Canvas 3D to WebGL, I ran into a problem with instanceof. In a particular line of code, I check if an object is an instance of a type. It always worked on Firefox 3.5 using Canvas 3D and everything renders properly. However, using Firefox 3.7a1pre, the conditional evaluated to false. I commented the line and I continued working eventually getting something drawn. I did this by adding ID’s to most of the C3DL classes as well as a getObjectType() function. This was simply a workaround so I could focus on more important tasks. This week I went back to the instanceof problem. I needed an isolated case to see if perhaps the library was at fault, so I wrote a short script in an HTML file. I found that on Firefox 3.5, it worked fine, but on Firefox 3.7a1pre, it didn’t. After mentioning this in #seneca on irc.mozilla.org, Chris Tyler suggested I file the bug. So I did. The next morning I continued to work on the bug. After talking with a number of people on IRC, I learned a few things. There is a JavaScript shell available when you check out the Firefox source. On my machine I found it at
mozilla-central/obj-ff-dbg/dist/bin/js
I started the shell and tried the folowing:
macbook-pro:bin andor$ ./js
js> var ns = {};
js> ns.test = function(){};
(function () {})
js> var iTest = new ns.test();
js> print(iTest instanceof ns.test);
false
Still false. I decided to update my repository and rebuild. Maybe the issue was already resolved and only existed for a few days? I went back to my console and updated.
hg pull
I then did a full build.
make -f client.mk build
The first thing I noticed is that the small icons in each tab are now cute little progress bars. progress bar Back to the issue, I ran the test again and it still fails. I’m pretty much stuck and this point in regards to the bug. I’ll either have to wait for someone else to confirm or I may try on another system. While I wait for that, I’ll be returning my attention back to porting to WebGL.
Categories
c3dl development
Comments rss
Comments rss
Trackback
Trackback

« Orbiter 1.1 3D Google maps demo »

Leave a comment

You can use these tags : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Videos

Demos

  • Asteroids-3D
  • RTS Prototype
  • Particle Systems Demo
  • Cross-Browser Orbiter
  • Mocap Demo With Spheres
  • Google Maps-3D

C3DL Development News

A spec change that keeps coming back to haunt me

At some point, the way firefox handles keyboard events changed. I’m not sure exactly when it happened, all I know is that it broke how I was dealing with keyboard interaction on almost every demo I’ve written (for example,the mocap demo and MotionView). When I wrote the demos, the keydown event would be fired once, [...]

Release 2.2

The 2.2 Release of the Canvas 3D Library includes a number of new features, updates to old features and fixes for several bugs along with the requisite changes to meet the evolving WebGL spec. Some of the things included (in no particular order) are: Better picking code. The ability to swap textures as a scene [...]

Tutorials

  • Tutorial #1: WebGL Browsers
  • Tutorial #2: A simple scene
  • Tutorial #3: Callback
  • Tutorial #4: Models
  • Tutorial #5: Light effects
  • Tutorial #6: Picking
  • Tutorial #7: Materials
  • Tutorial #8: Particle Systems
  • Tutorial #9: Camera Basics
    • Tutorial9-YawPitchRoll
  • Tutorial #10: Advanced FreeCamera
  • Tutorial #11: OrbitCamera
  • Tutorial #12: Advanced Camera Functions

Documentation

Archives

Archives

C3DL Development News

Recent Comments

  • June 2011
  • March 2011
  • October 2010
  • July 2010
  • April 2010
  • March 2010
  • February 2010
  • January 2010
  • December 2009
  • November 2009
  • October 2009
  • September 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • September 2008
  • August 2008
  • July 2008
  • June 2008
  • May 2008
  • April 2008
  • March 2008
  • February 2008
  • January 2008
  • December 2007
  • A spec change that keeps coming back to haunt me
  • Release 2.2
  • 2.1 Release and things to come
  • Level Up! An Open Web Game Jam
  • Site moved!
  • SceneCreator0.3
  • WWW2010 in Raleigh
  • Motionview
  • On the train to Mountainview
  • C3DL 2.0-WebGL and beyond
  • That depends on what... - peter
  • This application is ... - Haisens
  • I think that example... - peter
  • The above links are ... - Atash
  • Hi there, just wante... - Patrick H. Lauke
  • Firefox 4 was releas... - Cathy Leung
  • In order to access l... - peter
  • I am not able to dis... - preksha
  • "JavaScript can’t di... - Joe Hocking
  • I should point out t... - peter



Canvas 3d JS Library

©2007- 2010 Canvas 3d JS Library

Disclaimer: This website is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 Canada License.
The Canvas 3d JS Library and Demos found on this website are licenced under the MIT License

Creative Commons License