Coder Social home page Coder Social logo

Comments (2)

patriciogonzalezvivo avatar patriciogonzalezvivo commented on June 15, 2024

hi @danielchasehooper! For context we use .frag or .fs to distinguish fragment shaders from vertex shader (.vert or .vs). Files with .glsl extensions are a bit ambiguous, that's why usually you see them when they are part of libraries like on https://lygia.xyz.

Solution, you could create file pairs that include the .glsl counter part. For example:

shader.glsl

uniform vec2 u_resolution;
uniform float u_time;
void main() {
   vec4 color = vec4(0.0,0.0,0.0,1.0);
   vec2 uv = gl_FragCoord.xy/u_resolution;
   ...
   gl_FragColor = color;
}

shader.frag

#include "shader.glsl"

This way:

  1. you don't have duplicate files
  2. glslViewer can track the changes of the original .glsl file
  3. the .frag pairs can be easily generated programatically

from glslviewer.

danielchasehooper avatar danielchasehooper commented on June 15, 2024

we don't use the glsl extension, #include doesn't seem to work if the file doesn't have a glsl extension

It'd be useful if glslviewer had something like a --frag param so that you can launch it like so:
glslviewer --frag shaderFileName and it works with any extension.

from glslviewer.

Related Issues (20)

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.