a-big-triangle

WebJar for a-big-triangle

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

a-big-triangle
Last Version

Last Version

1.0.3
Release Date

Release Date

Type

Type

jar
Description

Description

a-big-triangle
WebJar for a-big-triangle
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/mikolalysenko/a-big-triangle

Download a-big-triangle

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/a-big-triangle/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>a-big-triangle</artifactId>
    <version>1.0.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/a-big-triangle/
implementation 'org.webjars.npm:a-big-triangle:1.0.3'
// https://jarcasting.com/artifacts/org.webjars.npm/a-big-triangle/
implementation ("org.webjars.npm:a-big-triangle:1.0.3")
'org.webjars.npm:a-big-triangle:jar:1.0.3'
<dependency org="org.webjars.npm" name="a-big-triangle" rev="1.0.3">
  <artifact name="a-big-triangle" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='a-big-triangle', version='1.0.3')
)
libraryDependencies += "org.webjars.npm" % "a-big-triangle" % "1.0.3"
[org.webjars.npm/a-big-triangle "1.0.3"]

Dependencies

compile (3)

Group / Artifact Type Version
org.webjars.npm : gl-vao jar [1.2.0,2)
org.webjars.npm : gl-buffer jar [2.1.1,3)
org.webjars.npm : weak-map jar [1.0.5,2)

Project Modules

There are no modules declared in this project.

a-big-triangle

Draws a big triangle that covers the entire viewport. Useful for GPGPU or when applying fullscreen postprocessing effects.

If you're wondering why a big triangle and not a big square made from two smaller triangles, there are potentially significant performance advantages in taking the former approach.

Example

var shell = require("gl-now")()
var drawTriangle = require("a-big-triangle")
var createShader = require("gl-shader")

var shader

shell.on("gl-init", function() {
  shader = createShader(shell.gl, 
  "precision mediump float;\
  attribute vec2 position;\
  varying vec2 uv;\
  void main() {\
    uv = position.xy;\
    gl_Position = vec4(position.xy, 0.0, 1.0);\
  }",
  "precision mediump float;\
  varying vec2 uv;\
  void main() {\
    gl_FragColor = vec4(uv, 0, 1);\
  }")
})

shell.on("gl-render", function() {
  shader.bind()
  drawTriangle(shell.gl)
})

Check it out in your browser

Install

npm install a-big-triangle

API

require("a-big-triangle")(gl)

Draws a fullscreen triangle.

  • gl is a WebGL context

Credits

(c) 2013

Versions

Version
1.0.3