New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

simplerjs

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simplerjs

simple syntax sugar for webgl

latest
Source
npmnpm
Version
1.0.6
Version published
Maintainers
1
Created
Source

simple js library for webgl syntax sugar.

Getting Started

npm install simplerjs --save 

yarn add simplerjs    

API Reference

import { getProgram } from 'simplerjs';

const program = getProgram(gl,vertexSource,fragmentSource);

Parameter Description

the getProgram function need three parameters.they are gl context for webgl,you can get it by:

const gl = canvas.getContext('webgl');

the second and third parameter are two script id of webgl shaders, just like:

<script id="vertexShader" type="shader">
        attribute vec2 v_position;
        uniform vec2 v_resolution;
        varying vec4 v_color;

        void main(){
           vec2 one = v_position / v_resolution;
           vec2 two = one * 2.0;

           vec2 res = two - 1.0;

           gl_Position = vec4(res, 0, 1);
           v_color = vec4(one * 0.9, 0.5, 1);
        }
    </script>

    <script id="fragmentShader" type="shader">
        precision mediump float;
        varying vec4 v_color;

        void main(){
            gl_FragColor = v_color;
        }
    </script>

the second and third parameters are vertexShader and fragmentShader. if everything is ok, a webgl program instance will be back.

Contributors

Keywords

ts

FAQs

Package last updated on 25 Oct 2019

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