Comments (10)
Do you have a repo? Here's working sample
from twgl.js.
Here is a project I made using twgl not too long ago; other than the twgl dependency these are the only two files needed:
http://pineapplemachine.com/demos/websand/sand.html
http://pineapplemachine.com/demos/websand/sand.js
When I downloaded the 3.8.0 release and tried using the new version in a new project, I was running into the aforementioned errors that I finally resolved by using 3.2.2 instead. When I tried switching this websand project to use 3.8.0, it broke with the same error. ("Render count or primcount is 0.") When I added an explicit count
argument, or tried also explicitly passing 0
for the following arguments, that warning stopped but the buffer didn't seem to render at all.
Here are the most relevant parts of the websand source:
Initializing a context
const gl = twgl.getWebGLContext(canvas, {
alpha: false,
antialias: false,
depth: false,
stencil: false,
});
twgl.setDefaults({
textureColor: [0, 0, 0, 1],
attribPrefix: "a_",
});
Creating a buffer info object
const bufferInfo = twgl.createBufferInfoFromArrays(gl, {
position: {
numComponents: 2, data: [0, 0, 0, 1, 1, 0, 1, 1]
},
});
Drawing the buffer info object
twgl.setBuffersAndAttributes(gl, programInfo, bufferInfo);
twgl.drawBufferInfo(gl, bufferInfo, gl.TRIANGLE_STRIP);
from twgl.js.
I downloaded your sample and replaced the library with 3.8.1 and it still worked for me. Any other ideas what I might be doing differently that it's working for me and not for you?
from twgl.js.
That's odd - when I was troubleshooting someone else was able to reproduce the problem on their machine too. When I'm back at my desk I will investigate further. In the meantime here's the specific js dependency I was loading. https://www.dropbox.com/s/fxaw4vcv9kbyb4h/twgl-full.min.js?dl=0
Sent from my Samsung SAMSUNG-SM-G891A using FastHub
from twgl.js.
That link leads to twgl 1.9.0 in which case I'd expect the error because one of the 2 big breaking change sbetween twgl 1.x and twgl 2.x was the order of arguments to twgl.drawBufferInfo
. From the changelist
twgl.drawBufferInfo(gl, primitiveType, bufferInfo)
Now in 2.x it's
twgl.drawBufferInfo(gl, bufferInfo, primitiveType)
from twgl.js.
A change in the order of arguments certainly explains the error, but I'm confused.
I downloaded 3.8.0 from here: https://github.com/greggman/twgl.js/releases/tag/v3.8.0
I used the js files in twgl.js-3.8.0/dist
. I now notice there's also 2.x
and 3.x
subdirectories, is it that the ones here are from 1.9.0 and the 3.8.0 js is in the subdirectory? But, I could swear I got the 3.2.2 dependency the same way.
If that is the case, then as a solution to this issue I would really like to suggest making it clearer which files actually belong to the latest release.
update: Yeah, I tested with the file in the 3.x
directory, which does say 3.8.0
in the comment on top, and everything works fine. So not an error with the new release, but the directory structure is definitely a source of confusion.
from twgl.js.
Okay, off the top of my head the best I can do is put a file in dist
dist/this-is-the-1.x-dist-folder-for-newer-dists-see-v.x-directories.md
Or something like that. The reason is people link directly to files in this repo (sadly) and I don't want to break them. If I change the files in dist their stuff will break
from twgl.js.
Ahhh why would people do that
What if you included links to download only the appropriate dist/ files rather than the entire repo in releases?
from twgl.js.
People do it for things like jsfiddle, codepen, jsbin, Stack Overflow Snippets, etc...
from twgl.js.
I still think that's silly
But I do think that adding the option to only download the dist files, like as a zip containing the relevant 4 js files, to releases would help a lot, and would be kind of convenient besides.
from twgl.js.
Related Issues (20)
- Dynamically changing attribute values, does it require to create bufferinfo everytime
- Last framebuffer's attached texture is empty? HOT 3
- Incorrect sentence structure.
- GPGPU particles example performance HOT 5
- resizeCanvasToDisplaySize in a web worker sets the width and height to 0 HOT 2
- Should not update the number of elements too HOT 1
- Question about simple triangle rendering HOT 1
- Inconsistent `type` type in `createAttribsFromArrays` HOT 8
- Defer checking shader compile status HOT 8
- Unsetting a texture in webgl2 HOT 3
- gl.useProgram(program); HOT 1
- bindTransformFeedbackInfo with offset HOT 3
- Get the jsdoc into the tsd HOT 2
- Incorrect TypeScript types of `createAugmentedTypedArray` HOT 2
- TEXTURE_COMPARE_MODE and sampler2DShadow HOT 4
- twgl-base package.json refers to non-existent `module` file HOT 2
- Cubemap uses only first texture HOT 3
- Rendering objects using drawObjectList causes skybox to not be rendered HOT 6
- `opt_locations` of createProgramInfo is missing from typescript bindings HOT 2
- webgpu support ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from twgl.js.