Category : glm-math

If I declare another glm::vec3 in my Camera class header (which contains several glm::vec3 declarations already), serious graphic bugs appear. So, normal situation: And if I add this single line to my Camera header: glm::vec3 foo; This appears: This happens regardless of the variable name. EDIT: here is the full header: #ifndef HEADER_Camera #define HEADER_Camera ..

Read more

I am developing a simple game in OpenGL and have made some tetrahedron models with textures. To save some space, I wanted to create a for loop that places these tetrahedrons at locations specified in a vector defined as follows in the header file (using namespace std because this was the template’s default): vector<glm::vec3> bushLocations; ..

Read more

I have a cube offset from the center of coordinates (0,0,0) to (-1,0,0) I need to rotate it. I use the difference in read pixels, that is, if the coordinates of the cursor were (200,200) and steel (201,200), then I need to rotate my cube a little counterclockwise. The code: glm::quat myquat; myquat = glm::angleAxis(glm::radians(((float)(previousXpos ..

Read more

I have this code for drawing a pyramid: model_matrix = glm::mat4(1.0f); glm::mat4 rm_x = glm::rotate(glm::mat4(1.0f), glm::radians(y_cube_rotation_speed_in_degrees), glm::vec3(0, 1, 0)); glm::mat4 rm_y = glm::rotate(glm::mat4(1.0f), glm::radians(x_cube_rotation_speed_in_degrees), glm::vec3(1, 0, 0)); cube_rotation_matrix = rm_x * rm_y * cube_rotation_matrix; model_matrix = cube_rotation_matrix * glm::scale(model_matrix, glm::vec3(x_cube_size_scale, y_cube_size_scale, 1.0f)); glm::mat4 normal_matrix = glm::transpose(glm::inverse(model_matrix)); I use model_matrix to display the pyramid and normal_matrix ..

Read more