Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error upon loading Uncaught TypeError: Cannot read property 'width' of null #150

Open
GoogleCodeExporter opened this issue Jul 29, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

<script type= "text/javascript" src="js/Detector.js"></script>
  <script type= "text/javascript"src="js/jsc3d.js"></script>
  <script type= "text/javascript"src="js/jsc3d.touch.js"></script>
 <script type= "text/javascript" src="js/jsc3d.webgl.js"></script>

<script type="text/javascript" id="virg">

var canvas= document.getElementById('virgin');
var viewer= new JSC3D.Viewer (canvas);

     viewer.setParameter('SceneUrl', 'virg.obj');
     viewer.setParameter('InitRotationX', 0);
     viewer.setParameter('InitRotationY', 0);
     viewer.setParameter('InitRotationZ', 0);
     viewer.setParameter('BackgroundColor', '#FFFFF');
     viewer.setParameter('RenderMode', 'texturesmooth');
     viewer.setParameter('SphereMapUrl', 'images/black.png');
     viewer.setParameter( 'Renderer', 'webgl');
     viewer.init();
     viewer.update();

        var ctx = canvas.getContext('2d');


    function changeDefinition(definition) {

                    if(definition == 'high' && viewer.isWebGLEnabled() && JSC3D.PlatformInfo.browser == 'chrome')
                    definition = 'standard';

                viewer.setDefinition(definition);
                viewer.update();
            }
</script>
What is the expected output? What do you see instead?
 I expect to have my obj loaded. in my console it says 
Uncaught TypeError: Cannot read property 'width' of null 
jsc3d.js:95

and anonymous function in my index referring to the .viewer

What version of the product are you using? On what operating system?

jscd 1.6.5


Original issue reported on code.google.com by [email protected] on 27 Feb 2015 at 11:01

@GoogleCodeExporter
Copy link
Author

I am wondering what can i do to remedy the situation. It says the issue is in 
the jsc3d.js line 95 that sets the parameters for this.frameWidth = 
canvas.width;  

Original comment by [email protected] on 27 Feb 2015 at 11:04

@GoogleCodeExporter
Copy link
Author

Not sure. It sounds like incorrect reference binding. How did you use the 
viewer instance? Have you checked whether the canvas object you passed to the 
viewer refered to a valid canvas element?

Original comment by [email protected] on 28 Feb 2015 at 4:05

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant