A C++ math library that is based on the GLSL language.

learn more… | top users | synonyms

4
votes
4answers
5k views

GLM: Euler Angles to Quaternion

I hope you know GL Mathematics (GLM) because I've got a problem, I can not break: I have a set of Eular Angles and I need to perform smooth interpolation between them. The best way is converting them ...
4
votes
1answer
715 views

Picking 3D with OpenGL ES 2

I'm trying to implement picking in my framework but I don't understand how I can do this. I'm working with: OpenGL ES 2. GLM mathematic library. What I have understand, picking can be made with ...
3
votes
2answers
2k views

Rotating an object when the center in not the origin - opengl

I'm beginning with GLSL and I learning the basic, I am using glm to do the matrix calculations at this point everthing ok,the problem is how I can move the origin to the center of my object, not the ...
3
votes
1answer
455 views

Rotating and Translating a Node in Horde3D with Matrices and Quaternions

I have been trying to learn how to use the Horde3D rendering engine for the past couple of days, and so far I have managed to learn a decent amount and integrate Bullet Physics with it as well. My ...
3
votes
2answers
7k views

Camera rotation - First Person Camera using GLM

I've just switched from deprecated opengl functions to using shaders and GLM math library and i'm having a few problems setting up my camera rotations (first person camera). I'll show what i've got ...
3
votes
0answers
225 views

Use quaterions to move the camera direction according to mouse movement

I am trying to use quaterions to move the camera direction vector in the following way. This code is perfectly working glm::quat temp1 = glm::normalize( glm::quat((GLfloat)( ...
3
votes
2answers
108 views

GLM/OpenGL: How Can I Prevent Vector Magnitude From Increasing While Rotating Bones in Skeletal Rig?

ANSWER AT THE BOTTOM OF THIS QUESTION I have been reading tutorials, articles, questions on StackExchange and books all with the subject of skeletal rigging. I have boiled my program down to just the ...
2
votes
1answer
2k views

How to implement a basic arcball camera in OpenGL with GLM

I only just started learning OpenGL and even things like vector maths etc a couple of days ago, so I am having a bit of trouble figuring out exactly what to do to implement an arcball camera system. ...
2
votes
1answer
1k views

Android ndk-build can't find glm headers

I am trying to port some boilerplate code of mine to work on android, using the android ndk & NativeActivity So far I have just one file that defines the glue between android and my code and it ...
2
votes
1answer
595 views

Skeletal animation with Assimp and glm

I'm trying to implement skeletal animation using assimp and glm. Everything seems to work, except for rotations. This is the code I use when packing assimp data into my own engine's format. I THINK ...
2
votes
1answer
1k views

Combining rotation,scaling around a pivot with translation into a matrix

In short: I need to combine rotation (in the form of a quaternion), scaling around a pivot point along with translation into a transformation matrix. The long: I am trying to implement a proprietary ...
2
votes
1answer
168 views

OpenGL - have object follow mouse

I want to have an object follow around my mouse on the screen in OpenGL. (I am also using GLEW, GLFW, and GLM). The best idea I've come up with is: Get the coordinates within the window with ...
2
votes
1answer
170 views

How to rotate camera around some point?

I have screen with dimensions: 800x600. The object that I want to rotate around is located at (400,300, -50) - center of the screen. Orthogonal projection: Near plan - 0.1f, far plane - 1000.0f left - ...
2
votes
0answers
65 views

How to calculate directional light frustum from camera frustum

I'm playing around with OpenGL for a few weeks now. For the following screenshot I picked the glm::ortho values for my lightsource by trial and error. There are two directional light sources with ...
1
vote
2answers
660 views

Matrix Rotation with three Angles

I want to rotate a form with three given angles fo each of the three axis. But the GLM rotation function takes only one angle and a vector as arguments. How can I convert between both formats?
1
vote
1answer
2k views

matrix 4x4 position data

I understand that a 4x4 matrix holds rotation and position data. The rotation data is held in the 3x3 sub-matrix at the top left of the matrix. The position data is held in the last column of the ...
1
vote
2answers
2k views

GLM: Quaternion SLERP Interpolation

I wish to interpolate two quaternion values. As I still can not get working results, can I kindly ask you to verify my function calls? The code below supports GLM (OpenGL Mathemathics) library, so ...
1
vote
1answer
203 views

How Extract Frustum Planes from Clip Coordinates?

I'm having some problems with my Frustum Culling and I want to debug it, so I'm trying to render it's planes, to see exatly the Frustum. But I'm using the Clip Coordinates to do the culling (like ...
1
vote
1answer
952 views

glm quaternion camera rotating on wrong axis

I'm trying to get my camera implemented with a glm::quat used to store the rotation. However, whenever I do circles with the mouse, the camera rotates along the axis I am viewing (i.e. I think it's ...
1
vote
2answers
161 views

What ways are there for making vector types available in scripting?

I use Google V8 engine to embed Javascript into my game for scripting. As interface to my native code, I already registered some C++ functions to the scripting context. In the native code, I make ...
1
vote
1answer
80 views

Get the address of a matrix in GLM library

Is there a way to get the address of a matrix from a GLM matrix? I'm using opengl 4 and glm library though I can't seem to find anything, which might help.
1
vote
0answers
67 views

OpenGL/GLM Camera

I want to make a camera that can freely look and walk on X/Z plane and rotate 360 degrees. I'm using OpenGL and the lookAt function from the GLM library to create the view matrix. I've looked through ...
1
vote
0answers
89 views

Determining axis to rotate around

I'm trying to implement a free-look third person camera (using glm). I know that the general transformation is newCameraPosition = translate(lookatPoint) * rotation(angle,axis) * ...
0
votes
2answers
799 views

Texture mapping issue in my Wavefront *.obj parser

I wrote a simple *.obj parser reading read vertices, texcoords and normals. But when I draw a model the texture isn't mapped correctly. I have already tried uv.y = 1.0f - uv.y to get inverted Y axis ...
0
votes
1answer
129 views

Build unity like Transform class [closed]

I am building a Unity-like Transform class. This is my header file: #include "Common.h" struct Transform { public: Transform(); void Translate(float x, float y, float z); ...
0
votes
1answer
96 views

Making particles accelerate toward a mouse point

I'm currently working on a particle simulation program that makes pixels move towards a mouse point continually accelerating, but i'm running into some math issues. Currently my particle will ...
0
votes
1answer
320 views

gluLookAt strange behavior implementing camera

I'm having a super tough time trying to implement what I thought would be a very straightforward problem. I'm trying to demonstrate a free camera that can move forward/back, strafe left/right, fly ...
0
votes
2answers
350 views

Translate camera position toward camera orientation

I have a camera position (Vec3) and camera horizontal/vertical angle. Now I want to translate my camera position toward the current camera orientation - what is the best way to do that? I am sure it's ...
0
votes
1answer
507 views

problem using glm::lookAt and glm::perspective

I'm trying to change the code from the 22th tutorial at http://ogldev.atspace.co.uk/, using the GLM library, but the result seems wrong. The problem is shown in the below picture: While it should be: ...
0
votes
1answer
366 views

How can I remove the view and projection matrix from ray position to get only the ray model?

I've got a little problem with my picking module and I need your help. I have a method to project a ray from the camera to a fixed point when I click somewhere. The computed ray looks good, it go to ...
0
votes
1answer
202 views

Box2D OpenGL debug renderer convert box2d coordinates to world space

I made an OpenGL 3.x renderer for Box2D's debug draw (b2Draw base class). Unfortunately I've tried for a while now to convert the box2D units, which are meters to my internal units which are pixels. I ...
0
votes
0answers
48 views

Bounding box center after transformation - want degree values for GUI

Similar to my previous question, I have a bounding box that I have transformed and scaled. Now, I want to get its center by doing this operation and store this value. bbCenter = glm::vec3(bbMin_x + ...
0
votes
0answers
54 views

GLM Rotating Combining Multiple Quaternions?

I have a camera which I want to control with my mouse. I want the mouse to control the pitch and yaw of the camera but not the roll. To avoid loss of significance, I am storing the quaternions for ...
0
votes
0answers
234 views

Space Strategy Ship Movement Math

This is similar to a question I asked a while ago, but I phrased it so terribly so might as well start over. I am trying to implement ship movement in 3D space, but confined to a 2D plane at y=0 (see ...
0
votes
1answer
178 views

Trying to convert as3 Matrix to C++ glm matrix

I am trying to convert a library called DragonBones to C++ Opengl which allows you to use Flash based skeletal animation. I'm almost done but I am running into a problem. I am trying to transform the ...
0
votes
1answer
368 views

vector rotations for branches of a 3d tree

I'm attempting to create a 3d tree procedurally. I'm hoping that someone can check my vector rotation maths, as I'm a bit confused. I'm using an l-system (a recursive algorithm for generating ...
-1
votes
1answer
167 views

Transformations are not correct using GLM and OpenGL

The aim of my program is to render a simple colored triangle in rotation. The rotations are correct if all Z values of my vertices are equals to 0.0f. If one of these values are different of 0.0f the ...
-2
votes
1answer
233 views

Incorrect rotations using openGL GLM and shaders [closed]

The goal of my program is to display a simple colored triangle rotating on the Y axis without any translation. I'm using the GLM library. The problem is that the transformations of my triangle are not ...