encima / encima/jsc3d

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

Open
#150 0 comments 0 reactions 0 assignees View on GitHub
auto-migrated Priority-Medium Type-Defect
Dominant language
HTML
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

```



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();
}

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 `ootsil.k...@gmail.com` on 27 Feb 2015 at 11:01

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the supplied HTML and inspect jsc3d.js:95, then compare the canvas lookup with the element referenced by the anonymous function in index. Reproduce the error using JSC3D 1.6.5 and the provided viewer setup; done when the cause of the null canvas reference is confirmed and loading the OBJ either works or has a clearly documented prerequisite.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.