# precision problems

This topic is 2571 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Im using the GLM library for my matrix transformation needs..

doing a quick test by just rotating a quad 90 degrees I come up with the following results

##### Share on other sites
Kind of difficult to help when we have no clue what you're doing.

##### Share on other sites
oh code of course xD

 glm::vec4 _vertices[] = { glm::vec4(-50.0f, -50.0f, 0.0f, 1.0f) , glm::vec4(-50.0f, 50.0f, 0.0f, 1.0f) , glm::vec4( 50.0f, 50.0f, 0.0f, 1.0f) , glm::vec4( 50.0f, -50.0f, 0.0f, 1.0f) }; std::cout<<std::endl<<"Untransformed vertices"<<std::endl; for (int _idx = 0; _idx < 4; _idx++) { std::cout<<"Vertex "<<_idx + 1<<" "; std::cout<<"X: "<<_vertices[_idx].x<<" " <<"Y: "<<_vertices[_idx].y<<" " <<"Z: "<<_vertices[_idx].z<<std::endl; } glm::vec4 _translation_vector(); float _rotation = glm::radians(90.0f); glm::mat4 _rotation_matrix = glm::rotate(glm::mat4(1.0f), _rotation, glm::vec3(0.0f, 0.0f, 1.0f)); for (int _idx = 0; _idx < 4; _idx++) { _vertices[_idx] = _rotation_matrix * _vertices[_idx]; } std::cout<<std::endl<<"Transformed vertices"<<std::endl; for (int _idx = 0; _idx < 4; _idx++) { std::cout<<"Vertex "<<_idx + 1<<" "; std::cout<<"X: "<<std::setprecision(3)<<_vertices[_idx].x<<" " <<"Y: "<<std::setprecision(3)<<_vertices[_idx].y<<" " <<"Z: "<<std::setprecision(3)<<_vertices[_idx].z<<std::endl; } 

##### Share on other sites
Looks like the rotation angle is in degrees but you pass the angle in radians.

nailed it !

1. 1
2. 2
3. 3
4. 4
5. 5
Rutin
17

• 9
• 12
• 9
• 12
• 37
• ### Forum Statistics

• Total Topics
631420
• Total Posts
2999990
×