Git Product home page Git Product logo

Comments (7)

schell avatar schell commented on August 23, 2024

Another option is using TemplateHaskell to read in the shaders as bytestrings at compile time - I've tried that before and it's not as friendly to updating as the other two methods.

from diagrams-opengl.

bergey avatar bergey commented on August 23, 2024

I've been meaning to switch over to TH, as I do in https://github.com/bergey/haskell-OpenGL-examples/blob/master/wikibook/tutorial-05-3D/TH.hs I figured that would make the shaders more pleasant to read & edit, but you're right that they shouldn't change often. Can you say more about to downsides to the TH method?

from diagrams-opengl.

schell avatar schell commented on August 23, 2024

This may be due to my noobness but what I found was that when I edited a shader the changes would not be integrated into the compiled project unless I deleted the intermediate file that ghc (or cabal, I'm not sure) produces containing the spliced TH code. Making edits to the shaders was therefore always a two step process. Since my motivation for separating the shaders from Haskell was just for syntax coloring I switched back.

from diagrams-opengl.

schell avatar schell commented on August 23, 2024

Though if the shaders are static then TH would be great.

from diagrams-opengl.

bergey avatar bergey commented on August 23, 2024

We agree that we should inline the shaders, either using TH or directly. The intermediate file issue you describe sounds really annoying, but I can't reproduce it. Could you try out the shader-th branch I just pushed?

I tested like this, and the shader change was picked up:

cabal install
ghcsandbox examples/curves # alias for sandbox-aware ghc
./examples/curves
# edit shader, make all fragments red
cabal install
ghcsandbox examples/curves
./examples/curves

from diagrams-opengl.

schell avatar schell commented on August 23, 2024

Confirmed working - I also couldn't recreate what I was talking about. It must have been something special in my build process. 👍

from diagrams-opengl.

bergey avatar bergey commented on August 23, 2024

Great. Thank you.

from diagrams-opengl.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.