Questions tagged [gl-matrix]

Javascript Matrix and Vector library for High Performance WebGL apps.

Resources:

40 questions
1
vote
1 answer

gl-matrix is not included properly in webgl application

I'm trying to learn the basics of webgl and following the MDN tutorial here. However, my rendering script (render.js) does not recognize the included gl-matrix script. Running index.html in Chrome(Version 88.0.4324.150 (Official Build) (64-bit)) I…
makenzin
  • 35
  • 3
1
vote
1 answer

How to interpolate a cube using fromRotationTranslationScaleOrigin in gl-matrix?

Code: https://plnkr.co/edit/QNA31hMYnIJwotwbaDhT?p=preview Question: How can I interpolate all properties of fromRotationTranslationScaleOrigin from gl-matrixin draw function of this cube? Let's interpolate over 3 seconds: from: q =…
Armeen Moon
  • 18,061
  • 35
  • 120
  • 233
1
vote
1 answer

WebGL, gl-matrix. How to get frustrum vertices from camera view and projection matrices?

I am using the gl-matrix library. For linear algebra calculations I have a view and projection matrix that I used for my camera in a 3d engine. The view is a lookat matrix. const view = mat4.lookAt( [], camera.eye, camera.target, …
kevzettler
  • 4,783
  • 15
  • 58
  • 103
1
vote
1 answer

Using SDL2 and OpenGL to rotate camera and a triangle draw wont display anything?

I am simply trying to create a triangle in the center and rotate the camera around the center. (0,0,0). the code is whipped from multiple tutorial sources and i suspect the problem could be somewhere from the glm::perspective/lookat or…
Sadern Alwis
  • 104
  • 1
  • 4
  • 17
1
vote
1 answer

Migrating to from glMatrix 1 to glMatrix 2

I haven't been able to update these functions from an old application using glMatrix 1.2 to glMatrix 2.7: calculateNormal() { mat4.identity(this.normalMatrix); mat4.set(this.modelViewMatrix, this.normalMatrix); …
Detuned
  • 3,652
  • 4
  • 27
  • 54
1
vote
0 answers

Smooth camera rotation in webgl

I have implemented a simple version of a camera. It's only purpose is to look around the scene (which means only rotation). Every frame I update then the mat4.lookAt and mat4.perspective (javascript math library), but on mobile (f.e. android), the…
greedsin
  • 1,252
  • 1
  • 24
  • 49
1
vote
0 answers

glMatrix quaternion rotation

Can anyone explain to me why this doesn't work as I would expect. Using a quaternion to rotate a vec3 [5,0,0] 180degree/Math.PI radians around the z axis. I would think the result would be [-5,0,0]; Rotating [5,5,0] gives [-5,-5,0] as…
user155595
  • 51
  • 6
0
votes
1 answer

Using perspective projection yields incorrect results

I use gl-matrix JS library to transform points in 3d. When I use model-view matrix (lookAt), the transformed points make sense. But when I add perspective projection on top of that, the resulting transformed points do not make much sense (the values…
Jakub M.
  • 32,471
  • 48
  • 110
  • 179
0
votes
0 answers

WEBGL2.0 3D translation for my 3D door model

I'm trying to translate my door to open along a certain axis. I can get it to rotate but I don't know how I can get it to translate along an axis. I cannot find any helpful code examples online elsewhere. This is my html code
0
votes
1 answer

Simple rotation using quaternions with gl-matrix.js

I'm trying to understand quaternions and am having a lot of trouble converting it into something actually useful. I've watched some 3blue1brown videos and read some tutorials, but I can't seem to translate what I see into something simple which…
Jason Goemaat
  • 28,692
  • 15
  • 86
  • 113
0
votes
1 answer

Why the humidity in DLNM(R) showed coef/vcov not consistent with basis matrix, but temperature was OK

everyone. I am using DLNM in R to analyze to lag-effect of climatic conditions on the prevalence of the disease. I followed somebody else's program strictly , and it worked in avg.temp and max.speed, but showed err "coef/vcov not consistent with…
0
votes
0 answers

How do I build a camera-facing matrix with a position using gl-matrix?

I'm building a simple particle system using javascript, webgl2, and gl-matrix. I have a circle mesh, some colors, some positions, a camera view matrix and a projection matrix. I can render un-rotated dots like this: render(viewMatrix,…
whiterook6
  • 3,270
  • 3
  • 34
  • 77
0
votes
1 answer

gl-matrix mat4 is missing Float32Array properties

I'm trying to setup a basic demo of WebGL + TypeScript, rendering a simple rectangle on the screen, adjusted for aspect ratio. I am trying to use gl-matrix to calculate the model-view-projection matrix, and upload it as a uniform. When I try to do…
tonayy
  • 173
  • 2
  • 12
0
votes
1 answer

Javascript - transforming device acceleration to earth coordinates

I'm having problem transforming device acceleration values to earth coordinate system in a web app using pure javascript (most questions with solutions are Android or iOS specific). I'm using the gl-matrix library to perform the calculations and…
0
votes
1 answer

Retrieve center point the viewer is looking at from view/perspective matrix

I use the glMatrix's method: mat4.lookAt(out, eye, center, up) to set a camera view when a WebGL model is rendering. After the model is rendered, I need to retrieve the center attribute from view/perspective matrix. I know how to retrieve the eye…
pronngo
  • 820
  • 11
  • 26