Jump to content

PIXI.DRAW_MODES.POINTS doesn't work?


kemu
 Share

Recommended Posts

Hi,

I'd like to render points with PIXI.DRAW_MODES.POINTS and shaders. But I am not successful in displaying it.

A minimul example is shown below.(https://codepen.io/raycast/pen/eYmvRoW)

 

const renderer = new PIXI.autoDetectRenderer();
renderer.view.id = 'pixi-canvas';
document.body.appendChild(renderer.view);

const geometry = new PIXI.Geometry()
.addAttribute('aVertexPosition',
              [100, 100,    // x, y
               100, 200,   // x, y
               300, 200], // x, y
              2)

const vertexSrc = `
precision mediump float;

attribute vec2 aVertexPosition;

uniform mat3 translationMatrix;
uniform mat3 projectionMatrix;

void main() {
  gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
}`;

const fragmentSrc = `
precision mediump float;

void main() {
  gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
}`;

const shader = PIXI.Shader.from(vertexSrc, fragmentSrc, null);
const mesh = new PIXI.Mesh(geometry, shader);
mesh.drawMode = PIXI.DRAW_MODES.POINTS;           // doesn't work
// mesh.drawMode = PIXI.DRAW_MODES.TRIANGLES;     // works fine

const stage = new PIXI.Container();
stage.addChild(mesh);
renderer.render(stage);

This code in any other PIXI.DRAW_MODE works fine.

WebGL Points exsample(https://codepen.io/duhaime/pen/YaRaNX) works too, 
so I think that the cause of this problem is not my environment.

-----
pixi v5.2.0
Windows10 / Chrome79.0.3945.88
-----

I'd really appreciate it if you could give me your advice.
 

Link to comment
Share on other sites

Honestly, I have no idea what can be wrong here. I used POINTS with pixi before , but not in v5. I traced execution flow, placed breakpoints, and it all looks good.

https://www.pixiplayground.com/#/edit/jJFqCi-UjS52XYR7VAGyD

Spector shows completely normal frame commands:

2019-12-20-16-26-19-e5oxq.png

Edited by ivan.popelyshev
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...