Socket
Socket
Sign inDemoInstall

glslify

Package Overview
Dependencies
Maintainers
17
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

glslify

A node.js-style module system for GLSL!


Version published
Weekly downloads
185K
decreased by-19.21%
Maintainers
17
Weekly downloads
 
Created

What is glslify?

glslify is a module system for GLSL (OpenGL Shading Language) that allows you to write modular shader code. It enables you to import and export GLSL code, making it easier to manage and reuse shader code across different projects.

What are glslify's main functionalities?

Importing GLSL Modules

This feature allows you to import GLSL code from other files, making it easier to manage and reuse shader code. The `glslify` function takes the path to a GLSL file and returns the shader code as a string.

const glslify = require('glslify');
const shader = glslify('./shader.glsl');

Using GLSL Modules

You can use `glslify` to import both vertex and fragment shaders, allowing you to modularize your shader code. This makes it easier to maintain and update your shaders.

const glslify = require('glslify');
const vertexShader = glslify('./vertex.glsl');
const fragmentShader = glslify('./fragment.glsl');

Inlining GLSL Code

You can also inline GLSL code directly within your JavaScript files using template literals. This is useful for small shaders or for quick prototyping.

const glslify = require('glslify');
const shader = glslify(`
  precision mediump float;
  void main() {
    gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
  }
`);

Transforming GLSL Code

glslify supports transforming GLSL code using plugins. In this example, the `glslify-hex` plugin is used to transform the GLSL code. This allows you to extend the functionality of glslify with custom transformations.

const glslify = require('glslify');
const shader = glslify('./shader.glsl', { transform: ['glslify-hex'] });

Other packages similar to glslify

Keywords

FAQs

Package last updated on 19 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc