question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Canvas Rendering displays black screen on pixi v6

See original GitHub issue

Hi all,

I went forward with migrating my project from v5 to v6. I updated all imports to use individual pixi modules, like import { Application } from @pixi/app. By the way, project is using multiple modules, and is being transpiled from TS to JS and bundled with webpack. After some initial struggles I managed to get the demo perfectly running on WebGL. But when loading the same demo in Canvas (forcing Canvas mode) the renderer doesn’t display anything. Initial issue that I had in Cavas mode, that CanvasRenderer wasn’t initialized, which I was able to fix with import '@pixi/canvas-renderer';. After that change, next issue that I faced was that the stage didn’t had renderCanvas() method. Adding additional import '@pixi/canvas-display'; solved that issue as well. But now I’m at a stage where the demo loads fine, without any issue, but it doesn’t display anything besides black screen. Stage object contains children, so it should display something.

Here’s a small snippet from my demo project:

` import { Application } from ‘@pixi/app’; import { Container } from ‘@pixi/display’; import ‘@pixi/mixin-get-child-by-name’; import ‘@pixi/canvas-renderer’; import ‘@pixi/canvas-display’;

export class PixiApplicationHandler { public app: Application | undefined; private pixelRatio: number;

constructor() {
	this.pixelRatio = this.getPixelRatio();
}

public createApplication(): void {
	const applicationOptions = {
		autoStart: false,
		width: window.innerWidth,
		height: window.innerHeight,
		resolution: this.pixelRatio,
	};
	this.app = new Application(applicationOptions);
	document.body.appendChild(this.app.view);
}

public render(): void {
	if (this.app) {
		this.app.render();
	}
}

`

My question would it be is it possible to fully support Canvas rendering by using individual pixi module imports? If it is, would you have any tip what else would need to be done to make it to show content? Or would I need to go back to classic import of the whole pixi lib?

Thanks

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
ivanpopelyshevcommented, Nov 22, 2021
  1. Either you use only bundles.
  2. Either you read bundles code and make your own.

https://github.com/pixijs/pixijs/blob/dev/bundles/pixi.js/src/index.ts https://github.com/pixijs/pixijs/blob/dev/bundles/pixi.js-legacy/src/index.ts

And here how spine works: bundle registers https://github.com/pixijs/spine/blob/2d04c071ed0ea1851f18c09e99d29fb0807ddc0f/bundles/pixi-spine/src/index.ts#L6

If you dont read source code - your options are limited, you have to wait when all the features will be documented. That depends on maintainers time, and on donations.

Now that you know that thing, please make PR to whatever place you want this info to be displayed in the docs.

0reactions
mcofkocommented, Nov 23, 2021

Thanks for the replay @ivanpopelyshev . The links you shared are very helpful.

When it comes to the documentation, I was just asking if I missed it anywhere. I’ll dig into the API docs and the source code then.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pixi.js - Pixijs with Meteor getting black canvas - Stack Overflow
Alright I figured it out, my code before: var stage = new PIXI.Stage(0x66FF99), renderer = new PIXI.autoDetectRenderer( 900,500, document.
Read more >
PIXI.RenderTexture - PixiJS API Documentation
Hint: All DisplayObjects (i.e. Sprites) that render to a RenderTexture should be preloaded otherwise black rectangles will be drawn instead.
Read more >
pixijs/pixi.js - Gitter
Hello! I am using pixi accessibility. My question is that I see the highlight box using Tab from the keyboard is not aligned...
Read more >
Games in PIXI producing a black/flickering screen on Huawei ...
Either the screen is completely black, or the screen flickers black, or the screen flickers black for a bit and then goes completely...
Read more >
Release notes - CodinGame SDK Documentation
Children with equal zIndices are now rendered by order of insertion in Groups and ... would sometimes try to animate frame 0, causing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found