Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [glm]

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

0
votes
0answers
22 views

Create AABB Cube from click-and-drag user rectangle? AABB OBB Collision Detection

I'm trying to create a 3D cube from rectangle drawn by ther user's mouse (think click-and-drag selection). My end goal is to use this to implement entity click-and-drag box selection. If you've played ...
0
votes
1answer
176 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
191 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
22 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
334 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
38 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
29 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
332 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
53 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
132 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
112 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
160 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
197 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
167 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
45 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
272 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 ...
0
votes
1answer
408 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: ...
0
votes
0answers
414 views

How do we rotate the camera around x axis 360 degrees?

How do we rotate the camera around x axis 360 degrees, without having to flip the axis, meaning without having the strange flip after we go over +-90 degrees on x axis? Mine behaves exactly the same ...
0
votes
2answers
309 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
175 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 ...
1
vote
1answer
4k 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
2k 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 ...
3
votes
1answer
846 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
268 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
192 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
0answers
69 views

How do I expand my algorithm to work for multiple AABBs?

I have followed this tutorial, with a few tweaks, to work for my C++ engine. My code will only work with one AABB in my list of AABBs; any more, and it ceases to function properly. With a similar loop ...
0
votes
2answers
94 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
399 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
281 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
287 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 ...
2
votes
0answers
38 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
351 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
72 views

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

This is what I'm doing: vertex shader: ...
0
votes
1answer
4k 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
152 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
142 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
812 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
84 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
220 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
389 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
267 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
1k 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
132 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
291 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
93 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 ...
2
votes
0answers
196 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 ...
3
votes
2answers
995 views

Quaternion based camera pitch freaking out, and Z-axis drift

This is the code I use to control my (first person) camera's movement and rotation. Translation successfully keeps orientation in mind, so that up and left and such are always in the expected ...
0
votes
1answer
300 views

Problem with Frustum Culling Right-Handed(LookAtRH GLM)

I am trying to do Frustum Culling based on Goemetric Approach, however don't matter how much i try, the frustrum rotate to opposite side, i tried to find a solution over all internet, but couldn't ...
3
votes
0answers
204 views

I get weird perspective using GLM where the depth is flipped. Please help

The depth is rendered wrong and I can't figure out why. ...
1
vote
0answers
323 views

AssImp Skeletal Animation Issues [closed]

Tried creating an animated mesh but I render it, it comes up as a flat mesh that moves with the camera. Followed the OGL Animation tutorial here (http://www.ogldev.org/www/tutorial38/tutorial38.html). ...