Jump to content

  • Log In with Google      Sign In   
  • Create Account


Drawing symmetric equilateral triangles


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Sythical   Members   -  Reputation: 138

Like
0Likes
Like

Posted 25 April 2014 - 12:27 PM

I'm rendering equilateral triangles of different sizes and I'm having trouble making them symmetric along the vertical axis. I'm aware of the diamond exit rule but I don't think that's the cause of the problem.

 

Here I have rendered two triangles. The triangle on the left (rendered correctly) has the coordinates (0.0, 0.0), (-7.0, 14.0) and (7.0, 14.0). The triangle on the right, on the other hand, has the coordinates (0.0, 0.0), (-7.0, 15.0) and (7.0, 15.0) and is not symmetric along the vertical axis.

 

WrgKTTN.png

 

Here are the matrices I'm using:

glm::mat4 model_matrix = glm::translate(glm::mat4(1.0f), glm::vec3(90.0f, 90.0f, 0.0f));
glm::mat4 view_matrix = glm::mat4(1.0f);
glm::mat4 projection_matrix = glm::ortho(0.0f, w * 1.0f, h * 1.0f, 0.0f);
glm::mat4 mvp_matrix = projection_matrix * view_matrix * model_matrix;

.

I don't see why the coordinates should make a difference as long as they're symmetrical. This problem also exists when I try to make triangles symmetric in the horizontal axis. Thanks for reading!



Sponsor:

#2 richardurich   Members   -  Reputation: 1187

Like
0Likes
Like

Posted 26 April 2014 - 03:36 AM

Those are not equilateral triangles, and you may or may not be encountering issues with the diamond exit rule. The diamond exit rule is kind of irrelevant because hardware and drivers are not designed for pixel perfect rendering anyways.

 

If you need to guarantee pixel perfect rendering, you need to do it by yourself. You can use ortho set to your exact screen resolution and draw nothing but rectangles with no rotation.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS