Questions tagged [gl-matrix]

Javascript Matrix and Vector library for High Performance WebGL apps.

Resources:

40 questions
14
votes
3 answers

Transformation order reversed in glMatrix?

In both scenes the transformations have to be swapped in glMatrix. i.e. to achieve 1) in glMatrix: mat4.translate(modelViewMatrix, modelViewMatrix, [0.6, 0.0, 0.0]); mat4.rotateZ(modelViewMatrix, modelViewMatrix, degToRad(45)); Why is the…
dmr
  • 163
  • 2
  • 6
14
votes
1 answer

Normals rotates wrong way when object is rotated

I am rendering a simple torus in WebGL. Rotating the vertices works fine but I have a problem with the normals. When rotated around a single axis, they keep the correct direction but when the rotation around a second axis increases, the normals…
Jave
  • 31,598
  • 14
  • 77
  • 90
5
votes
2 answers

2D zoom to point in webgl

I'm trying to create a 2D graph visualization using WebGL (regl, to be more specific). With my current implementation I can already see the force layout being applied to each node, which is good. The problem comes when I try to zoom with respect to…
3
votes
1 answer

How to import other types in to a typescript .d.ts module

I have a custom .d.ts file for an external module that looks like declare module 'vertices-bounding-box' { export default function boundingBox(positions: [number,number,number][]): [number, number] } Instead of [number,number,number] I would like…
kevzettler
  • 4,783
  • 15
  • 58
  • 103
2
votes
0 answers

Calculating Oblique Projection for WebGL

I am trying to create a portal rendering engine in WebGL 2.0 (so far I am trying to port this C++ project: https://github.com/HackerPoet/NonEuclidean), and am trying to implement oblique projection in order to align the clipping plane of the portal…
K. Russell Smith
  • 133
  • 1
  • 11
2
votes
1 answer

webgl translate javaScript

I'm trying to translate object by using mat4 here.. I know how to rotate the object but I failed to translate the object. I will be very thankful to everyone who helps me because I'm tired of trying to find a solution to my issue. Important code…
Ali jamal
  • 31
  • 6
2
votes
2 answers

webpack gl-matrix as an external

I'm writing a library using gl-matrix as a dependency. I'm using webpack to output the src and want to exclude gl-matrix part from my code but list it as a dependency. But turns out I can only packed the gl-matrix into the lib, or have error saying…
shrekshao
  • 388
  • 4
  • 12
2
votes
1 answer

How do I calculate the final bone matrix in skeletal animation?

I'm having trouble finding the final bone matrices for my skeleton. I know my bind pose matrices work, and I know my transform matrices work, but I figured multiplying them (which I'm calling the composite matrix) then multiplying them by its…
1
vote
1 answer

Can anyone tell me why my projection perspective matrix isn't working?

I'm a beginner in WebGL and graphics programming in general. I'm trying to render procedurally generated terrain. My first stab at this seemed to work and I get the following result. I want to add perspective projection to this, but I end up just…
1
vote
1 answer

wrong operand types - no operation '*' exists that takes a left-hand operand of type 'uniform lowp samplerCube'

I wanna add dir and amb light to the cubeMap sampler. Any sugestion? FS // shader for opengles native 'uniform samplerCube' CubeMap canvas2d textures. precision mediump float; precision highp float; varying vec3 vLightWeighting; …
Nikola Lukic
  • 4,001
  • 6
  • 44
  • 75
1
vote
1 answer

Zoom to specific rectangle multiple times using css matrix3d

I am trying to create a zooming image tool and for this I am using matrix3d with glMAtrix https://glmatrix.net/ I have the following components: canvas (black) which represents the final view smaller resizable rectangle (red) inside canvas an image…
V. Sambor
  • 12,361
  • 6
  • 46
  • 65
1
vote
1 answer

Uncaught ReferenceError: mat4 is not defined even gl-Matrix library is downloaded

I am building a 2d graphics engine using webgl, JavaScript and HTML, I wanted the gl-Matrix.js graphics library to do transformations so, I downloaded the lg-Matrix library zip file from their website https://glmatrix.net and extracted it into a…
equaidell
  • 65
  • 11
1
vote
0 answers

Implemeting raycast intro custom webgl - glmatrix based engine solution

If anyone wanna help or any type of suggestion (links) i would be satisfied. I create little engine with scene object based render. Success with triangle but only when camera is front of triangle . After App.camera.FirstPersonController = true you…
Nikola Lukic
  • 4,001
  • 6
  • 44
  • 75
1
vote
1 answer

WebGL and glMatrix minimal example with lookAt and perspective transformations

I am new to 3d graphics, and I am trying to figure out how to use the lookAt and perspective matrices in the glMatrix math library. Not trying to do anything fancy at this point, but I believe I am missing something, here is the relevant part of my…
user1763510
  • 1,070
  • 1
  • 15
  • 28
1
vote
2 answers

glMatrix - mat4 not defined

Hi, I downloaded toji-gl-matrix-21b745f. I copied the file dist/gl-matrix-min.js inside the web-root folder. In index.html i have: And inside in main.js i use: const…
FF84
  • 21
  • 3
1
2 3