GithubHelp home page GithubHelp logo

Comments (10)

greggman avatar greggman commented on September 7, 2024

Do you have a repo? Here's working sample

from twgl.js.

pineapplemachine avatar pineapplemachine commented on September 7, 2024

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.

greggman avatar greggman commented on September 7, 2024

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?

screen shot 2017-11-14 at 19 33 33

from twgl.js.

pineapplemachine avatar pineapplemachine commented on September 7, 2024

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.

greggman avatar greggman commented on September 7, 2024

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.

pineapplemachine avatar pineapplemachine commented on September 7, 2024

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.

greggman avatar greggman commented on September 7, 2024

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.

pineapplemachine avatar pineapplemachine commented on September 7, 2024

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.

greggman avatar greggman commented on September 7, 2024

People do it for things like jsfiddle, codepen, jsbin, Stack Overflow Snippets, etc...

from twgl.js.

pineapplemachine avatar pineapplemachine commented on September 7, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.