Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Questions tagged [glm]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
35 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
1answer
56 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
1answer
38 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
0answers
36 views

The X axis becomes the Y axis after a quaternion rotation

I am making a FPS game, and I have a for loop where I place out "ground" objects. (pseudo code) ...
0
votes
0answers
29 views

Yaw on a spherical world

I am trying to make a game where the player can walk along the surface of a spherical planet, and am not sure how to handle orientation. Pitch is relatively easy, as it is simply how much "above" or "...
0
votes
2answers
111 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
0answers
42 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 ...
0
votes
1answer
386 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
1answer
477 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
0answers
33 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 ...
0
votes
1answer
741 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
0answers
49 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
0answers
68 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 ...
0
votes
1answer
888 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 ...
0
votes
1answer
64 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 ...
0
votes
1answer
183 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 ...
-1
votes
1answer
186 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. ...
0
votes
1answer
242 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: ...
1
vote
1answer
331 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 ...
1
vote
1answer
293 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 ...
1
vote
0answers
52 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: ...
0
votes
1answer
426 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 ...
2
votes
1answer
713 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: ...
1
vote
2answers
484 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: ...
3
votes
1answer
324 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 ...
2
votes
1answer
6k 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 ...
1
vote
2answers
3k 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 ...
4
votes
1answer
1k 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 ...
0
votes
0answers
412 views

Create vector based on length, angle and origin vector

I have been trying to come up with a function that allows me to take in an origin vector, angle, and a length I want to be between the old and new vector, but I can't wrap my head around it. The ...
0
votes
1answer
261 views

Swept aabb 3d incorrect collision resolution along negative normals

I have followed this tutorial and ported it to 3d with glm. Everything works fine when the collision normal is reported as positive ((1,0,0),(0,1,0),(0,0,1)) but when it is negative the player aabb ...
0
votes
2answers
108 views

Create circular platform out of tiles

I am creating a 3d game. In this game I have a 3d model for a tile which I render in different locations using instancing. I want to create a number of these tiles arranged so as to approximate a ...
0
votes
2answers
647 views

Gradually rotate vector towards another vector

For a game I'm making there is an AI bot in it. I want it to rotate so that it is facing it's opponent. The direction it is facing is determined by a vector (it will face the direction that the vector ...
1
vote
1answer
408 views

How to get the center position for AABB of rotated mesh right?

I want to calculate the AABB for my rotated & translated mesh, but whatever I tried, I can't calculate the center position correctly if the mesh is rotated. My mesh is defined by an array of ...
1
vote
1answer
493 views

How to recalculate AABB after rotation?

I'm facing a problem trying to calculate the AABB on my models after rotation is applied. The rotation is not applied on the vertex positions directly, but in a seperate rotation matrix - just ...
3
votes
0answers
42 views

Testing spheres without extracting planes

I am currently a bit stuck. On OpenGL I am attempting to do view frustum culling, so far I managed to do it by using a PCM. Where center is the world position of the mesh. ...
0
votes
1answer
518 views

Aligning a weapon model with a first-person camera

The tools I am using are: gcc, opengl es 2 and glm. I am trying to align a weapon model with the first-person camera. The main issue is that I can not seem to figure out how to "anchor the weapon to ...
0
votes
0answers
78 views

My 3D Shader wont render light direction correctly opengl/c++/glsl

This is what I'm doing: vertex shader: ...
0
votes
1answer
6k views

Creating a movable camera using glm::lookAt()

I came across this tutorial on how to create a movable camera in OpenGL using glm::lookAt(glm::vec3 position, glm::vec3 target, glm::vec3 up). In the tutorial, in ...
0
votes
1answer
179 views

Algorithm to draw particles in correct order?

For a game I'm making as a hobbyist project, I need to be able to draw smoke on the screen. I am doing this by setting up a particle system. The problem is I need all the particles drawn in order from ...
0
votes
1answer
167 views

Calculating vertex_normals (vn) causes ugly lines C++/openGL

Im trying to procedurally generate planets for a project I'm working on. By adding noise to each vertex, I'm able to generate elevation, but without having updated vertice normals for my shader. It ...
0
votes
2answers
1k views

Why does GLM only have a translate function that returns a 4x4 matrix, and not a 3x3 matrix?

I'm working on a 2D game engine project, and I want to implement matrices for my transformations. I'm going to use the GLM library. Since my game is only 2D, I figured I only need a 3x3 matrix to ...
2
votes
1answer
94 views

What is the best way of storing transformations for an object and then applying them with OpenGL?

First some background info... I have been working on a platformer game, which I draw with OpenGL. The platforms are cubes and the player is a cube. The platforms and the player (both cubes) are ...
1
vote
0answers
258 views

How to use 3D transformation matrices with GLM old version that has simd functions

I need matrix 3D transformation, model transformation i.e scale-rotate-translate and then that model into world space so model-projection-view matrices. I need it with GLM specified simd vectors and ...
0
votes
2answers
628 views

glm::perspective isn't working?

So I'm learning how to make games and program, and while trying to setup a projection camera using GLM in GFLW, this line of code refuses to work and I can't figuire out why. The code is in the image ...
0
votes
1answer
321 views

Wierd behaviour upon limiting rotation on Y-axis

Okay, this is the code that works for a FPS camera, except it allows the player to flip it over by going under/over -/+90° rotation on Y-axis: ...
1
vote
2answers
2k views

How to use GLM Simd using GLM version 0.9.8.2?

I am new user for GLM, can somebody guide me how to use GLM SIMD using its version 0.9.8.2. According to its Manual using #define GLM_FORCE_SSE2 For example, if I write: ...
0
votes
1answer
163 views

Axis of affine transformation matrix

Let's say I have a right handed column major 4x4 transformation matrix. Can I safely assume (even though there exist non uniform scale) that first column is X axis vector, second column is Y axis ...
1
vote
1answer
362 views

Should I use the X-Y-plane when using an orthographic projection in OpenGL?

I'm currently at a loss rendering a tile-based 3D map with an orthographic projection in OpenGL. Imagine any isometric 3D game (using actual geometry instead of sprites). Internally, the tiles of my ...
1
vote
0answers
110 views

Shadow Mapping, why does my shadow change size and position when I rotate my light?

I have looked far and wide for this and have not found any issue like this, so far. Basically, when my light is at a certain angle my shadows seem to be correctly positioned and scaled, yet if I ...
3
votes
0answers
245 views

Limit/Clamp camera movement using quaternions

I'm making a camera object for rendering with OpenGL. However, instead of using the typical "LookAt" method I'm trying to use just a Quaternion for orientation and a Vector3 for position. Instead of ...