{"id":20778144,"url":"https://github.com/stackgl/gl-texture2d-read-float","last_synced_at":"2025-04-30T18:42:12.535Z","repository":{"id":33691026,"uuid":"37343825","full_name":"stackgl/gl-texture2d-read-float","owner":"stackgl","description":"Read out the contents of a floating-point gl-texture2d","archived":false,"fork":false,"pushed_at":"2016-02-13T23:16:20.000Z","size":5,"stargazers_count":11,"open_issues_count":1,"forks_count":1,"subscribers_count":18,"default_branch":"master","last_synced_at":"2024-04-27T00:07:44.236Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stackgl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-12T20:47:51.000Z","updated_at":"2022-02-26T17:29:03.000Z","dependencies_parsed_at":"2022-09-13T05:20:37.982Z","dependency_job_id":null,"html_url":"https://github.com/stackgl/gl-texture2d-read-float","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackgl%2Fgl-texture2d-read-float","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackgl%2Fgl-texture2d-read-float/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackgl%2Fgl-texture2d-read-float/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackgl%2Fgl-texture2d-read-float/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stackgl","download_url":"https://codeload.github.com/stackgl/gl-texture2d-read-float/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225041128,"owners_count":17411593,"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":[],"created_at":"2024-11-17T13:19:28.279Z","updated_at":"2024-11-17T13:19:28.852Z","avatar_url":"https://github.com/stackgl.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gl-texture2d-read-float\n\n[![experimental](http://badges.github.io/stability-badges/dist/experimental.svg)](http://github.com/badges/stability-badges)\n\nRead out the contents of a floating-point\n[gl-texture2d](http://github.com/stackgl/gl-texture2d).\n\nThis will *eventually* be supported natively in WebGL\n[(it's listed in the OpenGL ES 3 spec)](https://www.khronos.org/opengles/sdk/docs/man31/html/glReadPixels.xhtml),\nbut this fills that need until then!\n\n## Usage\n\n[![NPM](https://nodei.co/npm/gl-texture2d-read-float.png)](https://nodei.co/npm/gl-texture2d-read-float/)\n\n### `read(glTex2d, done(err, data))`\n\nReads out the contents of `glTex2d`, which should be an instance of\n`gl-texture2d`. When complete, `done(err, data)` will be called where `data` is\na `Float32Array` containing the resulting floats in the texture.\n\n``` javascript\nconst canvas    = document.createElement('canvas')\nconst gl        = require('gl-context')(canvas)\n\nconst read      = require('gl-texture2d-read-float')\nconst Texture2d = require('gl-texture2d')\nconst baboon    = require('baboon-image')\nconst assert    = require('assert')\n\nconst texture  = Texture2d(gl, baboon)\n\nread(texture, function(err, data) {\n  if (err) throw err\n\n  assert.deepEqual(data, baboon.data)\n})\n```\n\nA few things to note:\n\n* Right now, this is slow as it requires reading data back from the GPU.\n  There's not much that can be done about this for the time being unfortunately.\n* The data is retrieved synchronously under the hood, but the API has been made\n  asynchronous in preparation for WebGL's eventual async `readPixels` equivalent.\n* Only `gl.RGBA`/`gl.FLOAT` textures are currently supported. Pull requests are,\n  however, very welcome! :)\n\n## Contributing\n\nSee [stackgl/contributing](https://github.com/stackgl/contributing) for details.\n\n## License\n\nMIT. See [LICENSE.md](http://github.com/stackgl/gl-texture2d-read-float/blob/master/LICENSE.md) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackgl%2Fgl-texture2d-read-float","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstackgl%2Fgl-texture2d-read-float","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackgl%2Fgl-texture2d-read-float/lists"}