{"id":17791290,"url":"https://github.com/schell/gristle","last_synced_at":"2025-03-16T15:31:34.551Z","repository":{"id":66386444,"uuid":"131446132","full_name":"schell/gristle","owner":"schell","description":"Like ixshader but ergonomic","archived":false,"fork":false,"pushed_at":"2020-09-27T05:48:45.000Z","size":58,"stargazers_count":9,"open_issues_count":4,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-27T11:05:21.186Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/schell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-28T21:42:34.000Z","updated_at":"2021-10-05T22:53:15.000Z","dependencies_parsed_at":"2023-03-28T00:22:09.018Z","dependency_job_id":null,"html_url":"https://github.com/schell/gristle","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schell%2Fgristle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schell%2Fgristle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schell%2Fgristle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schell%2Fgristle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/schell","download_url":"https://codeload.github.com/schell/gristle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243822312,"owners_count":20353496,"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-10-27T10:50:32.336Z","updated_at":"2025-03-16T15:31:34.545Z","avatar_url":"https://github.com/schell.png","language":"Haskell","readme":"# gristle\nThis is the spiritial successor to [ixshader](https://github.com/schell/ixshader).\nIt was started at [BayHac2018](https://wiki.haskell.org/BayHac2018) and I hope to\nuse it as the bottom layer of rendering in [gelatin](https://github.com/schell/gelatin).\n\n# Table of Contents\n1. [Prerequisites](#prerequisites)\n2. [Installation](#installation)\n3. [Usage](#usage)\n4. [Contribuitors](#contribuitors)\n\n# Prerequisites\n\nIn order to run this you need to have installed\n* Haskell\n* Stack\n    * [Instructions](https://docs.haskellstack.org/en/stable/README/)\n* SDL2\n    * [for linux] `sudo apt install libsdl2-dev`\n\n# Installation\n\n* clone this repo\n    * `git clone https://github.com/schell/gristle.git`\n* enter the directory\n    * `cd gristle`\n* install the project\n    * `ghc Setup.hs`\n    * `stack install`\n\n# Usage\n`stack install` generates two commands:\n\n    gristle-exe\n\nand\n\n    gristle-example-exe\n\n* `gristle-exe` runs the code written in `gristle/app/Main.hs`. Right now that code generates the glsl code for the haskell shader and outputs it on the terminal.\n\n* `gristle-example-exe` runs the code written in `gristle-example/app/Main.hs`. Right now it runs a color gradient shader in a window.\n\n\u003cimg\n    src=\"https://i.imgur.com/FBjtSYn.png\"\n    alt=\"window with gristle example running\"\n/\u003e\n\n## see\n```haskell\n{-# LANGUAGE DataKinds #-}\nmodule Main where\n\nimport Gristle\n\nvertex\n  :: Value (In (Vec 2 Float))\n  -\u003e Value (In (Vec 4 Float))\n  -\u003e Value (Uniform (Mat 4 4))\n  -\u003e Value (Out (Vec 4 Float))\n  -\u003e GLSL ()\nvertex position _ _ outColor = do\n  let (x, y) = decomp $ readAttrib position\n      pos4   = vec4 x y 0.0 1.0\n  outColor .= pos4\n\nfragment :: Value (In (Vec 4 Float)) -\u003e Value (Out (Vec 4 Float)) -\u003e GLSL ()\nfragment inColor outColor = outColor .= readAttrib inColor\n\n-- | A demonstration of using Haskell's type system to generate glsl shaders.\n--\n-- \u003e\u003e\u003e main\n-- -------------------- vertex\n-- in vec2 a;\n-- in vec4 b;\n-- uniform mat4 c;\n-- out vec4 d;\n-- void main () {\n--   d = vec4(a[0], a[1], 0.0, 1.0);\n-- }\n-- \u003cBLANKLINE\u003e\n-- -------------------- fragment\n-- in vec4 a;\n-- out vec4 b;\n-- void main () {\n--   b = a;\n-- }\n-- \u003cBLANKLINE\u003e\nmain :: IO ()\nmain = putStr $ unlines [ replicate 20 '-' ++ \" vertex\"\n                        , glsl $ shader vertex\n                        , replicate 20 '-' ++ \" fragment\"\n                        , glsl $ shader fragment\n                        ]\n```\n\n# Contribuitors\n\n* [Schell Carl Scivally](https://github.com/schell)\n* [Karen Palacio](https://github.com/karen-pal/)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschell%2Fgristle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fschell%2Fgristle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschell%2Fgristle/lists"}