42 questions
-2
votes
1
answer
84
views
rotating image using webGL in a wide canvas
i am developing a web app that will be able to do some image transformations one of them is image rotation, the problem is: as long as the canvas is square ( width = height ) every thing is ok, but ...
1
vote
2
answers
396
views
How do I get 3D coordinates of clicked point and in fragment shader in WebGL?
I draw a unit sphere of objects (stars, sprites etc), which all have 3D coordinates on the "surface" of that sphere. The camera is at the center of it and I use perspective projection to ...
0
votes
0
answers
44
views
From Cannonjs Quat to GLMatrix rotation modelView - fromQuat not working
I use glmatrix 3.4.0 .
Any suggestion !
mat4.identity(object.mvMatrix);
this.mvPushMatrix(object.mvMatrix, this.mvMatrixStack);
mat4.translate(object.mvMatrix, object.mvMatrix, object.position....
2
votes
0
answers
255
views
perspective divide and clipping
EDIT3:
Hi, The question might not be super clear, that is because I'm not sure I completely understand the problem myself. I think it seems to be "negative w" causing the issue. Other posts ...
0
votes
1
answer
44
views
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 ...
1
vote
1
answer
366
views
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 ...
1
vote
1
answer
3k
views
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 ...
1
vote
1
answer
171
views
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 ...
1
vote
1
answer
1k
views
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 ...
1
vote
1
answer
1k
views
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 ...
1
vote
1
answer
407
views
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, ...
1
vote
1
answer
3k
views
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 ...
0
votes
0
answers
170
views
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 ...
4
votes
3
answers
5k
views
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:
<script src="gl-matrix-min.js"></script>
<...
2
votes
1
answer
1k
views
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(...
3
votes
1
answer
2k
views
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]
}...
2
votes
0
answers
323
views
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 ...
1
vote
1
answer
1k
views
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 ...
1
vote
1
answer
328
views
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 ...
0
votes
1
answer
362
views
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-...
1
vote
1
answer
1k
views
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(...
1
vote
1
answer
1k
views
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 ...
5
votes
2
answers
3k
views
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 ...
2
votes
1
answer
1k
views
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 ...
1
vote
1
answer
290
views
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, ...
0
votes
1
answer
535
views
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/...
1
vote
1
answer
2k
views
How to understand/use gl-matrix function fromRotationTranslationScale()
I have a cube in GL in this plunkr that looks like this:
I would like to scale, rotate and translate the cube from a pivot.
to hopefully make it animate like https://www.youtube.com/watch?v=...
2
votes
2
answers
923
views
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 ...
-1
votes
1
answer
654
views
How am I supposed to use glMatrix 2.3.2 in a HTML project?
I am doing a HTML/Javascript project and part of it involves using glMatrix. My problem is that I have no idea how it actually implement it and use it.
I tried doing what you'd usually do to use a ...
1
vote
1
answer
11k
views
how to convert world space transform to object space transform?
i'm trying to implement :
transform.InverseTransformPoint(Vector3)
and
transform.InverseTransformDirection(Vector3)
using glm library in opengl.
i have view ,projection ,model matrices for each ...
0
votes
1
answer
1k
views
webgl rotate texture on the face of cube does not rotate around itself
i need help with webgl.
i draw a simple cube and apply texture on each face of cube,and i am rotating the texture on the each face of the cube but the problem is:
the texture does not rotate around ...
1
vote
0
answers
900
views
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 ...
0
votes
0
answers
416
views
How to calculate difference between two spatial rotations
I'm trying to convert physical orientation of a mobile device got from deviceorientation event to a series of camera rotations in my sort of 3D viewer. The problem is that I need to do spatial ...
0
votes
0
answers
1k
views
Multiplying not working with with gl-matrix.js's function mat4.multiply
I want to multiply 2 matrices with the gl-matrix.js library gl matrix mat4
The multiplication does work f.e. this :
var testMat = mat4.create();
mat4.multiply(testMat, this._transformations[...
0
votes
1
answer
2k
views
How can I use GLMatrix to do matrix multiplications?
I'm just beginning to try to find/use a matrix operations library for JS. I want to do simple translation, scale, and rotation operations on 2D matrices. The mozilla developer website recommends ...
15
votes
3
answers
4k
views
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, ...
0
votes
1
answer
571
views
Adding a Property to the Top-level Object in a Node Module
In a node.js module a variable declaration stays private inside the module:
var a = 'x';
Let's say, I want to declare a number of variables in this manner. I cannot use the following code, because ...
14
votes
1
answer
2k
views
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 ...
1
vote
0
answers
2k
views
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];
...
2
votes
1
answer
2k
views
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 ...
0
votes
1
answer
413
views
Quaternion rotation by phi and theta instead of xyz in gl-matrix
gl-matrix's quaternion object has 3 functions rotateX, rotateY and rotateZ which rotates quaternion by the specific axis.
Now I want to do the same using phi and theta instead of xyz.
How is this ...
0
votes
2
answers
928
views
distance/magnitude between quaternions, but ignore roll
I'm searching for a way to determine if a camera (a) is looking at the same direction than a specific object (b).
I'm only working with the rotations because here we don't care about the positions (...