Skip to content

Commit

Permalink
support webgl1
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentDouchin committed Apr 20, 2023
1 parent 1c0921b commit 1f92509
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Globals/Initialize.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Clock, Mesh, MeshStandardMaterial, NearestFilter, OrthographicCamera, PlaneGeometry, Scene, ShaderMaterial, WebGLRenderTarget, WebGLRenderer } from 'three'
import { Clock, Mesh, MeshStandardMaterial, NearestFilter, OrthographicCamera, PlaneGeometry, Scene, ShaderMaterial, WebGL1Renderer, WebGLRenderTarget, WebGLRenderer } from 'three'
import { World, init } from '@dimforge/rapier2d-compat'

import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer'
Expand Down Expand Up @@ -42,7 +42,12 @@ const createCamera = (update: boolean) => {

// ! Renderer
const createRenderer = () => {
const renderer = new WebGLRenderer({ alpha: true })
let renderer: WebGL1Renderer | WebGLRenderer
try {
renderer = new WebGLRenderer({ alpha: true })
} catch {
renderer = new WebGL1Renderer({ alpha: true })
}
renderer.setPixelRatio(window.devicePixelRatio)
renderer.setSize(window.innerWidth, window.innerHeight)
window.addEventListener('resize', () => {
Expand Down

0 comments on commit 1f92509

Please sign in to comment.