Questions tagged [glm]
GLM is a C++ math library based on the GLSL language.
154 questions
1
vote
0
answers
48
views
CGLM Not Rendering with Sokol [closed]
I've setup cglm from a wrap configured with Meson, and have copied one of the samples from https://github.com/floooh/sokol-samples/tree/master (cube-sapp, to be exact). I've tried to replace sokol's ...
0
votes
2
answers
96
views
Position camera to 'head' joint's position in skeletal animation
Finished this great tutorial on skeletal animation:
https://learnopengl.com/Guest-Articles/2020/Skeletal-Animation
All works as expected, no issues!
Here is what matrixes I use to achieve skeletal ...
1
vote
0
answers
72
views
Cannot transform vectors from viewport to world
I started working on a small raytracer project, and i decided to reuse my already existing openGL renderer to do this, i'm using GLM to manage transforms/positions.
However, i stumbled upon a very ...
0
votes
1
answer
350
views
Mouse Ray Picking: Z-Coordinate of Projected vector (glm::unproject)
I've run into a curious issue when implementing ray picking in my game engine.
It seems the Z coordinate of the Projected matrix has to be ever so slightly more than ...
0
votes
0
answers
98
views
Bullet physics incorrect rotation with more than one axis
im try to integrate currently bullet into my game framework. But when i try to set the rotation for an rigidbody with more the 1 axis i recive the current result
It looks that the rotation is ...
0
votes
1
answer
146
views
Vulkan Phong shader problem
Light increases its intensity as it come closer the origin model.
Vertex Shader:
...
0
votes
1
answer
1k
views
glm::frustum vs glm::perspectiveFov
When I use glm::perspectiveFov(90.0f,512.0f,512.0f,1.0f,256.0f) I receive a working perspective projection with 90° in both x and y, as seen below (camera is in ...
0
votes
1
answer
322
views
Unprojecting screen space to world space stops working when camera not at origin
I'm trying to implement screen space to world space in my engine to allow object selection in editor. I understand that the process should essentially be the reverse of projection. So to go from world ...
0
votes
1
answer
145
views
Transforming a ray to NDC coordinates
I am trying to have ray tracing with a mesh using NanoRT and I want to be able to allow for a model transform on top of my view and projection transforms.
I have successfully transformed my ray from ...
0
votes
1
answer
259
views
glm::eulerAngles gives unexpected output for quaternion
I used the euler->mat4->quat to give the right result, but euler->quat gives the wrong result - is there something I did wrong?
...
1
vote
1
answer
835
views
Implementing a Maya-like orbit camera in Vulkan/OpenGL
I want to create an orbit camera with zooming, panning, and rotation. I used the following examples to create cameras:
https://stackoverflow.com/questions/54400422/how-to-implement-altmmb-camera-...
1
vote
1
answer
1k
views
How do I increment a quaternion rotation in update()?
When working with rotations expressed as angles, it makes sense to be able do to something like
void GameLoop::update(){
pawn.rotation.x += 0.01;
}
And slowly ...
0
votes
0
answers
62
views
How to calculate angles after subsequent rotations?
I have a class that manipulates a model matrix in opengl:
...
2
votes
1
answer
1k
views
How to make a concisely, elegantly, and human-friendly Quaternion camera?
I have spent three weeks struggling with the quaternion camera!
Now I have two Implementations. One has some kind of gimbal lock issue or something like that. Another one is totally anti-human ( I ...
1
vote
1
answer
1k
views
How is the GLM '*' operator on quaternion and vec3 defined?
Using the definition of quaternion rotation given here:
So the equivalent code in GLM of the above formula would be like this:
...
1
vote
0
answers
234
views
Calculating bone transformation matrix for vertex skinning
I have an issue with calculating transformation matrices for animation mesh deformation using glm in c++
I have a class Bone which does the basic calculation which does have a current local position (...
1
vote
1
answer
1k
views
Applying incremental rotation with quaternions: flickering or hesitating
I'm having a couple of problems while rotating an object every frame with GLM.
First problem
I'm trying to rotate the object with a small increase using quaternion multiplication.
...
0
votes
1
answer
408
views
NVidia Physx Get Orientation problem
For a game that I am developing I moved from Bullet physics to NVidia Physx. The problem that I have is the following. I used to have a translation from bullet's rigid body orientation quaternion to ...
0
votes
0
answers
798
views
What am I doing wrong with this GLM camera rotation?
I'm attempting a very basic camera with GLM in C++ that has full pitch and yaw rotation. The game I'm planning to make will eschew triangles in favor of flat scaled/rotated sprites to represent ...
2
votes
1
answer
299
views
Smoothing multiple combined vector translations
I am currently working on my arm/weapon rig for an fps game written in a custom engine. I am to the point where I am implementing the movement of the arms/weapon (hereby referred to as weapon), for ...
0
votes
1
answer
758
views
Why clip in clip space - confusion with Gribb-Hartmann clip plane extraction
I understand to extract clip planes from the perspective matrix one can follow the methodology laid out by Gribb-Hartman as documented here:
http://www.cs.otago.ac.nz/postgrads/alexis/planeExtraction....
0
votes
1
answer
1k
views
How do I calculate a matrix to render a mirror about a plane using GLM?
I've been trying to work out how to render a mirror for a while now, but a lot of resources I find either use very outdated tools I'm not familiar with, appear to be college slides referencing other ...
0
votes
1
answer
539
views
Calculating child world translation, rotation and scale
I'd like to know if it's possible to calculate a child's world translation, rotation and scale individually. I'm used to seeing devs resorting to matrix multiplication and then decomposition, like so:
...
0
votes
1
answer
489
views
Rotation matrix for a model where the forward axis is not +X
I'm trying to convert a normalized unit vector, representing an entity heading, into a rotation matrix for rendering.
The problem is that I'm using an (apparently) unusual forward vector for my ...
1
vote
1
answer
7k
views
Orthographic projection not showing a triangle
I just want to draw a simple triangle using GL_LINES primitive with orthographic projection matrix.
This is my vertices...
...
0
votes
0
answers
270
views
rotate sprite without stretching
I am attempting to rotate the sprites in my game, but they get stretched whenever it happens. I know that it is due to the screen not being square, but I can not figure out the correct way to ...
3
votes
1
answer
712
views
Matrix math in cascade shadow mapping
I am implementing cascade shadow mapping algorithm and currently stuck with matrix transformations - my AABBs, when projected in light space are pointing in the direction opposite to the light:
I was ...
0
votes
1
answer
1k
views
Why is transform matrix order is reversed in my Scene graph implementation?
I have researched this a lot and so far all the examples, tutorials etc always use the following order: Scale * Rotate * Translate but for some reason this order must always be backwards in my Scene ...
0
votes
1
answer
2k
views
Get world object transform relative to another object (potential parent)
I'm attempting to parent a bullethole decal to a dynamic object. I've figured out how to set the correct position for the bullethole object so that it shows at the correct position of the dynamic ...
0
votes
1
answer
234
views
How would I go about coloring marching cubes terrain?
I'm making a game with marching cubes terrain (I know very original idea) and I don't exactly know how to color it. I have a system to do it, I just need to know how to interpolate it where it's not ...
0
votes
1
answer
3k
views
convert world to screen coordinates with camera position and camera angle
Heyho :)
I'm trying to convert world coordinates to screen coordinates. I have available: fov, screen width, screen height, camera position, camera angle and obviously the position of the object in ...
1
vote
2
answers
2k
views
Rotating an object to face the same direction as another object
Feel like I should know this, maybe I'm just over thinking it. What I'm attempting to do is create a bullet hole plane/texture object on top of an existing mesh when a ray cast returns a hit point. I ...
3
votes
1
answer
2k
views
Euler angle and Quaternion conversion become weird when yaw is bigger than 90 degrees
I'm writing a camera which needs to change a quaternion to Euler angles than change them back, it only works when the yaw is less than 90 degrees, I wrote a example to check:
...
0
votes
1
answer
548
views
How do I calculate the bounding box for an ortho matrix for Cascaded shadow mapping?
I've been trying to get a cascaded shadow mapping system implemented on my engine, though it appears to be that the bounding boxes for the cascades aren't correct.
The part I'm interested in can be ...
1
vote
0
answers
135
views
Subtract a circle on a rectangle - OpenGL
I am writing a game using GLFW, GLEW, GLM and Bullet3 in C++. Its a Maze with holes. I am doing the floor with rectangles (wich is 2 GL_TRIANGLES).
I want to make some woles (circles), to the ball ...
0
votes
1
answer
335
views
Simplifying Camera Strafing
I have a camera that follows the position and direction of the player. These are updated using spin and velocity. The velocity is updated like so:
...
2
votes
1
answer
528
views
ASSIMP Skinning seems to be somewhat inverted
I'm currently implementing Skinning using Assimp as my asset importer. I've relied heavily on the following tutorial in order to skin meshes (http://ogldev.atspace.co.uk/www/tutorial38/tutorial38.html)...
0
votes
0
answers
2k
views
OpenGL viewport is stretched
For this project I am using GLFW, glad and glm.
My window looks like this:
The dimensions of the window are correct, but the viewport is stretched, making my square into a rectangle.
How do I use a ...
2
votes
1
answer
3k
views
GLM conversion from euler angles to quaternion and back does not hold
I am trying to convert the orientation of an OpenVR controller that I have stored as a glm::vec3 of Euler angles into a ...
2
votes
1
answer
2k
views
Storing transformations in game objects. (GLM, C++)
I'm currently writing a game engine from scratch for learning purposes. I just started implementing transformations. I know how they work in general but I'm not sure how to implement them efficiently ...
1
vote
1
answer
491
views
Opengl Airplane Camera
I am making a game in opengl and am trying to get a camera to follow an airplane. How can I get the camera to match the roll, pitch, and yaw of the plane? I am using glm as my math library. Thanks!
1
vote
1
answer
361
views
Find angle (slope) of collision plane?
I have implemented a collision and response system based on the famous "Improved Collision detection and Response" paper. However I'm having an issue with objects sliding backwards on slopes. I ...
0
votes
2
answers
859
views
Problem Implementing SAT Collision in 3D, OBB vs OBB
I am trying to implement SAT collision detection between 2 OBBs, however, I am getting a lot of false positives, can anyone help me figure out what I am doing wrong, thank you in advance.
This is my ...
1
vote
0
answers
153
views
Matrix for transforming a square to a quadrilateral
I have a square of points {<0, 0, 0>, <6, 0, 0>, <6,0, 6>, <0,0,6>}
(The square is placed at the origin in the xz plane in opengl).
Want to apply a transformation/s on the square and make ...
1
vote
1
answer
3k
views
how to use glm::rotate with a eulerangle?
I have a vec3 to represent my object's orientation/rotation but the glm::rotate method expects a quaternion. If I just convert ...
0
votes
1
answer
3k
views
GLFW - Camera rotation system
I need to make a camera rotation system similar to the one here
http://madebyevan.com/webgl-path-tracing/
To rotate, press the Left mouse button and drag. So far I figured a basic idea of how this ...
0
votes
0
answers
72
views
GLM: Camera attached to model moves in opposite direction from the model
I have been working on a component based engine with nested game objects each with there own transformation's. Each game object calculates its position in the world based on its parents world ...
1
vote
1
answer
3k
views
Camera Pitch, Yaw from View Matrix
I have a camera that works with Pitch and Yaw (no roll) and compute the look at matrix as following :
...
1
vote
0
answers
140
views
Get world position from Fragment Depth
I am trying to write the depth value in a G-buffer pass and then read it later to determine the world-space location of a fragment.
I have this shader which renders my G-buffer pass
...
1
vote
0
answers
270
views
Get world position from depth buffer
I have a buffer I am rendering gl_FragDepth (remapped to range 0-1) to a color buffer (instead of color) in OpenGL
I would like to, in a second pass, read this ...