{"id":20626836,"url":"https://github.com/mikbry/react-webgl-app","last_synced_at":"2025-07-29T02:38:34.155Z","repository":{"id":43995605,"uuid":"239521454","full_name":"mikbry/react-webgl-app","owner":"mikbry","description":"Boilerplate to create a React \u0026 WebGL app","archived":false,"fork":false,"pushed_at":"2023-01-05T06:53:46.000Z","size":1255,"stargazers_count":4,"open_issues_count":7,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T21:51:06.398Z","etag":null,"topics":["canvas","hooks-api-react","react","webgl"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mikbry.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-10T13:43:02.000Z","updated_at":"2022-10-12T06:40:07.000Z","dependencies_parsed_at":"2023-02-03T16:46:44.804Z","dependency_job_id":null,"html_url":"https://github.com/mikbry/react-webgl-app","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":"mikbry/RollupReactApp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikbry%2Freact-webgl-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikbry%2Freact-webgl-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikbry%2Freact-webgl-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikbry%2Freact-webgl-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mikbry","download_url":"https://codeload.github.com/mikbry/react-webgl-app/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249094946,"owners_count":21211838,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["canvas","hooks-api-react","react","webgl"],"created_at":"2024-11-16T13:14:51.011Z","updated_at":"2025-04-15T15:21:39.359Z","avatar_url":"https://github.com/mikbry.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `react-webgl-app`\n\nBoilerplate to create a minimal React \u0026 WebGL app.\n\n![Example](public/images/example.png)\n\nIt is made using [rollup-react-app](https://github.com/mikbry/RollupReactApp). The WebGL code is an heavily modified example from [Mozilla](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial/Animating_objects_with_WebGL).\n\n## Why\n- Create a minimal from scratch React + WebGL app.\n- No Three.js\n- use React's hook\n\nIt will be enhanced with more examples and an article.\n\n## How it works ?\n\n### 1 - WebGL needs a canvas\n\n`GLVIew` component  renders a `\u003ccanvas /\u003e` element. GLView iis using the [React Effect Hook](https://reactjs.org/docs/hooks-effect.html) to make the animation works. The code is very simple:\n\n```javascript\nconst GLView = ({ width, height, scene }) =\u003e {\n  const ref = useRef();\n\n  useEffect(() =\u003e {\n    const canvas = ref.current;\n    const webGL = new WebGL(canvas, width, height);\n    webGL.init(scene);\n    return () =\u003e {\n      webGL.close();\n    };\n  });\n\n  return \u003ccanvas ref={ref} width={width} height={height} /\u003e;\n};\n```\n\n### 2 - All the GL stuff \n`WebGL` is the engine where WebGL, shaders, model are intialized. \n\nThe rendering animation is done using:\n\n```javascript\n    this.render = this.render.bind(this);\n    this.requestId = requestAnimationFrame(this.render);\n```\n\n### 3 - Where the magic plays\n`scene.js`\n\nAll the model, shaders, are here and also the scene rendering.\n\n## Community\n\nDon't hesitate to test, use, contribute, ...\n\nMade by [Mik BRY](http://twitter.com/mikbry) \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikbry%2Freact-webgl-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikbry%2Freact-webgl-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikbry%2Freact-webgl-app/lists"}