Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Questions tagged [glm]

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

Filter by
Sorted by
Tagged with
1 vote
1 answer
43 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. ...
user avatar
0 votes
1 answer
20 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 ...
user avatar
  • 23
0 votes
0 answers
27 views

How to modify UV data using GLM/OpenGL

I am attempting to translate texture coordinates in an interlaced VBO the same way I translate vertex positions. That is ...
user avatar
0 votes
0 answers
111 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 ...
user avatar
2 votes
1 answer
201 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 ...
user avatar
  • 171
0 votes
1 answer
47 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....
user avatar
0 votes
1 answer
135 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 ...
user avatar
0 votes
1 answer
83 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: ...
user avatar
0 votes
1 answer
37 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 ...
user avatar
  • 762
1 vote
1 answer
984 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... ...
user avatar
0 votes
0 answers
50 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 ...
user avatar
2 votes
1 answer
119 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 ...
user avatar
0 votes
1 answer
140 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 ...
user avatar
  • 189
0 votes
1 answer
215 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 ...
user avatar
  • 171
0 votes
1 answer
113 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 ...
user avatar
0 votes
1 answer
195 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 ...
user avatar
  • 1
0 votes
2 answers
395 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 ...
user avatar
  • 171
2 votes
1 answer
798 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: ...
user avatar
0 votes
1 answer
329 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 ...
user avatar
1 vote
0 answers
58 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 ...
user avatar
0 votes
1 answer
154 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: ...
user avatar
1 vote
1 answer
275 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)...
user avatar
  • 209
0 votes
0 answers
469 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 ...
user avatar
2 votes
1 answer
1k 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 ...
user avatar
1 vote
1 answer
609 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 ...
user avatar
1 vote
1 answer
227 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!
user avatar
1 vote
1 answer
116 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 ...
user avatar
  • 171
0 votes
2 answers
403 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 ...
user avatar
1 vote
0 answers
63 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 ...
user avatar
1 vote
1 answer
2k 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 ...
user avatar
0 votes
1 answer
2k 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 ...
user avatar
0 votes
0 answers
52 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 ...
user avatar
  • 433
1 vote
1 answer
2k 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 : ...
user avatar
  • 362
1 vote
0 answers
76 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 ...
user avatar
1 vote
0 answers
169 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 ...
user avatar
0 votes
1 answer
2k 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 ...
user avatar
0 votes
1 answer
106 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 ...
user avatar
  • 3
0 votes
1 answer
268 views

Problem with FPS camera in Software Renderer

I am currently creating a software renderer (I know they aren't particularly useful anymore, it is purely from a knowledge and learning standpoint). I am using GLM and following OpenGL rules(as GLM is ...
user avatar
  • 3
-1 votes
1 answer
553 views

Get enemy/chaser object to face player object - OpenGL

My chaser object will not face the player object. It simply keeps spinning around and won't face the player. ...
user avatar
  • 99
0 votes
1 answer
363 views

glm rotating quaternion in Y axis deforms object

I'm implementing my own game engine in C++ and I need help here, I have a game object, its orientation property is a quaternion and I want to rotate it A degrees in the Y axis. So, I have: ...
user avatar
  • 1
1 vote
1 answer
533 views

Orthographic Projection viewable area

I have a simple orthographic projection that is rotated at an arbitrary angle on any combination of the three axes. I am trying to use these matrices to calculate the viewable area of the screen for ...
user avatar
1 vote
1 answer
427 views

Quaternion Rotation Weird Rotation

I have an fps camera, and i am representing rotation with quaternions. every frame i grab how much the mouse moved that frame and then i simply do ...
user avatar
1 vote
0 answers
76 views

Unwanted continuous rotation with Quaternion

I am probably missing something simple but ... this is how I'm calculating the world matrix of my object: ...
user avatar
0 votes
1 answer
964 views

Camera follow 3D Object OpenGL

I'm trying to make my camera follow a 3D object, the X and Y values from the camera position are the same as the 3D object, but the Z axis is not the same, it has an offset of 13.0f so the camera ...
user avatar
  • 85
2 votes
1 answer
2k views

Rotate an object to face a point with glm::lookAt

I want to rotate an object to face a point, such as the monster look at the player. For that I've decided to use the glm::lookAt function. However the following does not yield good results: ...
user avatar
  • 362
0 votes
2 answers
919 views

OpenGL object movement is not smooth and vibrating

In my android NDK OpenGL C++ project, I have a render method which executes every frame on draw event so this is the algorithm: ...
user avatar
3 votes
1 answer
882 views

How to 'point' an arrow in the direction that it's going?

I am relatively new to OpenGL and 3D environments and am having trouble creating a rotation matrix that will rotate an arrow model so it 'points' in the direction that it is going. I am using GLM as a ...
user avatar
4 votes
2 answers
16k views

Direction vector to quaternion

I have a unit vector (direction) which represent a rotation around Y axis, and would like to turn this into a quaternion to represent the same rotation. I use GLM library, but interested any library ...
user avatar
  • 143
2 votes
2 answers
9k views

Getting Vector at 90 Degrees from provided vector

I need a function that can take a vector as an input and provide a vector that is at a 90-degree angle to the provided vector. I understand that in 3D there is an infinite amount of vectors that could ...
user avatar
  • 433
4 votes
1 answer
3k views

Why is the size of glm's vec3 struct 12 bytes?

When trying to determine the size of glm::vec3 (from GLM math library) by using the size of operator like so: sizeof(glm::vec3) I get 12 returned. When I look at ...
user avatar
  • 393