Questions tagged [glm]

GLM is a C++ math library based on the GLSL language.

Filter by
Sorted by
Tagged with
0 votes
1 answer
43 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 ...
Josh McCord's user avatar
0 votes
0 answers
49 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 ...
Andy's user avatar
  • 13
0 votes
1 answer
63 views

Vulkan Phong shader problem

Light increases its intensity as it come closer the origin model. Vertex Shader: ...
BrutaL _'s user avatar
0 votes
1 answer
322 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 ...
Raildex's user avatar
  • 761
0 votes
1 answer
159 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 ...
ZachMakesGames's user avatar
0 votes
0 answers
60 views

Сollision detection c++

In the cube class I have its position and rotation. Also I have a collision check function: ...
Het Best's user avatar
0 votes
1 answer
71 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 ...
Felipe Gutierrez's user avatar
0 votes
1 answer
118 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? ...
Zero Skyline's user avatar
1 vote
1 answer
440 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-...
Wusiki Jeronii's user avatar
1 vote
1 answer
903 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 ...
TaylorE's user avatar
  • 359
0 votes
0 answers
45 views

How to calculate angles after subsequent rotations?

I have a class that manipulates a model matrix in opengl: ...
Aziz Hakberdiev's user avatar
1 vote
1 answer
671 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 ...
potter john's user avatar
1 vote
1 answer
763 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: ...
peter's user avatar
  • 21
1 vote
0 answers
147 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 (...
NoFr1ends's user avatar
1 vote
1 answer
841 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. ...
Daniel Marques's user avatar
0 votes
1 answer
266 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 ...
Mike F's user avatar
  • 93
0 votes
0 answers
671 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 ...
Dunyctor's user avatar
2 votes
1 answer
250 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 ...
whitwhoa's user avatar
  • 201
0 votes
1 answer
488 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....
Humility Dev's user avatar
0 votes
1 answer
987 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 ...
Ethan McTague's user avatar
0 votes
1 answer
344 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: ...
Daniel Marques's user avatar
0 votes
1 answer
286 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 ...
Nairou's user avatar
  • 584
1 vote
1 answer
5k 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... ...
Enthalpy127's user avatar
0 votes
0 answers
192 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 ...
Aubrey Champagne's user avatar
3 votes
1 answer
464 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 ...
shybovycha's user avatar
0 votes
1 answer
778 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 ...
Gasim's user avatar
  • 199
0 votes
1 answer
1k 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 ...
whitwhoa's user avatar
  • 201
0 votes
1 answer
191 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 ...
Austin128's user avatar
0 votes
1 answer
2k 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 ...
itsame's user avatar
  • 1
1 vote
2 answers
1k 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 ...
whitwhoa's user avatar
  • 201
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: ...
ravenisadesk's user avatar
0 votes
1 answer
464 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 ...
Héctor Miguel Ramírez Cano's user avatar
1 vote
0 answers
98 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 ...
David Pires's user avatar
0 votes
1 answer
259 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: ...
user1032677's user avatar
1 vote
1 answer
413 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)...
Sammi3's user avatar
  • 219
0 votes
0 answers
1k 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 ...
egordiac's user avatar
2 votes
1 answer
2k 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 ...
Vittorio Romeo's user avatar
2 votes
1 answer
1k 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 ...
Tin Svagelj's user avatar
1 vote
1 answer
396 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!
That_one_guy's user avatar
1 vote
1 answer
295 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 ...
whitwhoa's user avatar
  • 201
0 votes
2 answers
664 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 ...
Shubham Sachdeva's user avatar
1 vote
0 answers
108 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 ...
Argha Chakraborty's user avatar
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 ...
Thomas Linssen's user avatar
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 ...
gallickgunner's user avatar
0 votes
0 answers
61 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 ...
0xen's user avatar
  • 453
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 : ...
FloFu's user avatar
  • 392
1 vote
0 answers
109 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 ...
Geklmintendon't of Awesome's user avatar
1 vote
0 answers
226 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 ...
Geklmintendon't of Awesome's user avatar
0 votes
1 answer
3k views

OpenGL calculate circle rotation around a given point

I'm trying to rotate an object around a certain point. If this point is the center of my world space I use the following algorithm: glm::vec3 center is the center ...
linux_lover's user avatar
0 votes
1 answer
110 views

Restore object right vector to horizontal position using quaternions

I'm fairly new in gamedev mathematics and i have a problem i cannot solve on my own. I'm working on L-System tree generation engine and i'm having serious difficulities while trying to work out ...
Blamad's user avatar
  • 3