I have the following code in c++ for(int count = 0; count < 10; count++) { glm::vec4 vec(1.0f, 0.0f, 0.0f, 1.0f); glm::mat4 trans; trans = glm::translate(trans, glm::vec3(1.0f, 1.0f, 0.0f)); vec = trans * vec; cout << "x: "<< vec.x <<" y: "<< vec.y <<" z: "<< vec.z << endl; } The loop prints the following ..

#### 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 ..

I have a problem implementing frustum culling in OpenGL. I implemented plane extraction in world space, using this Lighthouse3d tutorial (the rest of the engine comes from learnopengl.com). It works well, but only when the camera points towards the horizon. If the camera points up or down, the frustum becomes progressively narrow. Indeed, far frustum ..

My code sometimes works and sometimes it does not this is my main file. I get this error Access violation reading location 0x0B42F000 I don’t understand why, I have been scratching my head for a day or two trying to figure it out but I gave up. The problem occurs more when I increase the ..

I’m trying to create a toggle to change between ortho and perspective views. I have successfully coded buttons to initiate camera movement but can’t figure out how to code a button to perform this change. How I would toggle the projection modes here? My code so far: #include <iostream> // cout, cerr #include <cstdlib> // ..

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; ..

I want to create a simple game engine with OpenGL using C++. I did all the lighting and stuff, but i wasn’t able to create shadows for my objects. I want to know what is wrong with my code or at least have an idea about what should i do. I checked https://learnopengl.com/ and i ..

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 ..

I followed the popular tutorials on skeletal animation by Thin Matrix and another code sample on GitHub The mesh renders find without any animations. But as soon as animations are applied it gets skewed. If I pass identity matrices as bonetransforms, it works. Works as in it still renders properly just without any animation. Also ..

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 ..

## Recent Comments