Iacus

Members
  • Content Count

    8
  • Joined

  • Last visited

  1. Hello again. I'm coming back to this after a few days off... So, I converted the values to grays with full alpha and packed them as a Uint32Array, and yet I get this error: WebGL: INVALID_OPERATION: texImage2D: type UNSIGNED_BYTE but ArrayBufferView not Uint8Array or Uint8ClampedArray This is an excerpt of the code I have. I only get a black square despite the values in the array looking ok let options = { width: width, height: height, }; let colorValues = Uint32Array.from(colorHexValues); let br = new PIXI.resources.BufferResource(colorValues, options); let bt = new PIXI.BaseTexture(br); let texture = new PIXI.Texture(bt); let noiseImg = new PIXI.Sprite(texture); noiseImg.position = { x: 100, y: 100 }; this.root.addChild(noiseImg);
  2. I'm trying this method but I'm not sure which range of values my array should have. Right now it has floats from 0.0 to 1.0. I keep getting error core.es.js:822 WebGL: INVALID_OPERATION: texImage2D: no bound PIXEL_UNPACK_BUFFER and the texture is a black rectangle. It's also 1 value per pixel but I'm thinking it probably expects 3 or 4 values per pixel?
  3. How can I do this with an off-screen canvas? I don't really want to have a p5 sketch on the page as well...
  4. Hello, I'd like to visualize a simplex noise map by representing the values as shades of gray on a 2d image. While using Processing/p5js I used to be able to access the pixels array and then set the values and update the image. Is there any similar way of achieving this in pixi, or should I look elsewhere? If I had to build the image in p5, can I convert it to a pixi texture right away? (meaning, without intermediately saving it to disk or similar)
  5. I feel that should either be made into an API that behaved as you expect or at least documented better, so users know what to expect... Anyway, it seems I've managed to solve it using an undocumented alternate sysntax that allows you to specify the callback at add time, but it would have taken a lot less if the documentation wasn't so lacking...
  6. Ok, I suspect my onComplete function triggers twice, so when I load() the second step, it runs the callback again, trying to re-add the resources. Is there any method to tell the loader I only want to run the onComplete once?
  7. Ok, and what is parentResource and how should I use it? And yes, the Image parameter could be the same for more than one tileset but in that case the error would make sense, as I'm not interested in loading the texture twice
  8. Hello, I'm trying to load sprite sheets to build a tiling map in Pixi. I have my spritesheets defined in a custom data structure like so: { "image": "../aside/tileset_1bit.png", "spacing": 0, "tile_height": 16, "tile_width": 16 } Now, I add the json file to the loader, and hit loader.load(), calling an onComplete function: let loader = new PIXI.Loader(); let path = './data/spritesheets/dev_tileset.json'; loader.add(path); loader.onComplete.add((loader) => loadSpriteTextures(loader)); loader.load(); function loadSpriteTextures(loader) { for (let key in loader.resources) { if (loader.resources[key].extension == 'json') { let data = loader.resources[key].data; let { image, spacing, tile_height, tile_width, } = data; let sheet = new Spritesheet(image, spacing, tile_height, tile_width); spriteSheets.push(sheet); loader.add(sheet.image); } } } Except, when I call loader.add(sheet.image), I get an error: "resource-loader.esm.js:1992 Uncaught Error: Resource named "../aside/tileset_1bit.png" already exists." I know for a fact that the image "../aside/tileset_1bit.png" does *not* exist in the loader. If I don't call the add() and try looking, it's not there (as expected). I need the second load() step to actually load the images into the loader, which I'd later reference from my Spritesheet object, but this error is baffling me. Any ideas what cause this? Is it a bug?