How to correctly set these up on a engine-only project?
You could use something like this … that will let you use WebGPU at some point too. Engine examples do this.
const gfxOptions = {
deviceTypes: [deviceType],
glslangUrl: '/static/lib/glslang/glslang.js',
twgslUrl: '/static/lib/twgsl/twgsl.js',
antialias: false
};
pc.createGraphicsDevice(canvas, gfxOptions).then((device: pc.GraphicsDevice) => {
otherwise look at the WebglGraphicsDevice constructor / Application constructor on what can be passed to it.
Can this be simplified as:
const app = new pc.Application(canvas, {
mouse: new pc.Mouse(document.body),
keyboard: new pc.Keyboard(window),
antialias: true,
powerPreference: 'high-performance',
});
?
options for the device are passed as graphicsDeviceOptions, see
https://developer.playcanvas.com/en/api/pc.Application.html#Application
and see here what can be passed:
https://developer.playcanvas.com/en/api/pc.WebglGraphicsDevice.html#WebglGraphicsDevice
so something like
const app = new Application(canvas,
{
graphicsDeviceOptions: {
antialias: true
}
});
1 Like
Thanks!
const app = new pc.Application(canvas, {
mouse: new pc.Mouse(document.body),
keyboard: new pc.Keyboard(window),
graphicsDeviceOptions: {
antialias: true,
powerPreference: 'high-performance'
}
});
app.graphicsDevice.maxPixelRatio = window.devicePixelRatio;
...
Checking using: pc.app.graphicsDevice.initOptions ~>
alpha: false
antialias: true
depth: true
powerPreference: "high-performance"
stencil: true
1 Like