You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Alias for state store to avoid redundant calls for global state
this.glState=this.gl.renderer.state;
// create the buffers
for(letkeyinattributes){
this.addAttribute(key,attributes[key]);
}
Why this is problem?
Because:
1: you enforced drops a vao binding
2: allocate a buffers when it not required. This is bad idea because gl can be passed before that renderer was assign.
Also there are a strong reference to renderer state, that can be invalid for draw because can be resets into new object for some reason, for example for binding to another webgl libs, like pixi.
Why this bad? There are not garanteed that attributeOrder is valid. Should be check on empty value.
This can be easy demonstrated when program is sub class or was invalid. Draw method should be thrownable and crash when invalid state reached.
3. RenderTarget issues (Critical)
3. Texture issues
Directly state check and state update while update
Problem that not all texture can was update. VideoTextures MUST wait readyState of HTMLVideoElement. This means that you MUST bind and activate texture but NOT upload it.
Textures should split activation/bind and uploading process.
Possible solution:
Move texture bind and state check to renderer + isolate update and upload.
The text was updated successfully, but these errors were encountered:
Thanks for this lib, but there are some problems!
Strange code structure that produce side effects.
Folow: #24
So, i think that this Core API look poor, because produce untraceable sideeffects:
1. Program issues
Direct state read from
monkey
field:ogl/src/core/Program.js
Line 149 in 2635658
Direct state push into
monkey
field:ogl/src/core/Program.js
Line 154 in 2635658
Why this is problem:
gl
which already is problem, because GLContext not hasrenderer
field, this is pre-mixed field - poor code.currentProgram
from current id that can be manually changed by some reason. Unstable, can produce side-effects!Possible solution:
Replace this:
ogl/src/core/Program.js
Lines 148 to 154 in 2635658
onto this:
And move check of current active program inside useProgram.
2. Geometry issues
ogl/src/core/Geometry.js
Lines 43 to 52 in 2635658
Why this is problem?
Because:
Also there are a strong reference to renderer state, that can be invalid for draw because can be resets into new object for some reason, for example for binding to another webgl libs, like pixi.
ogl/src/core/Geometry.js
Line 47 in 2635658
Possible solutions:
Move preparation step onto draw method and remove reference.
ogl/src/core/Geometry.js
Lines 170 to 174 in 2635658
Why this bad? There are not garanteed that
attributeOrder
is valid. Should be check on empty value.This can be easy demonstrated when program is sub class or was invalid. Draw method should be thrownable and crash when invalid state reached.
3. RenderTarget issues (Critical)
3. Texture issues
Directly state check and state update while update
ogl/src/core/Texture.js
Line 86 in 2635658
State reference holding, again:
ogl/src/core/Texture.js
Line 64 in 2635658
Problem that not all texture can was
update
. VideoTextures MUST wait readyState of HTMLVideoElement. This means that you MUST bind and activate texture but NOT upload it.Textures should split activation/bind and uploading process.
Possible solution:
Move texture bind and state check to renderer + isolate update and upload.
The text was updated successfully, but these errors were encountered: