Hey! raylib forum is closing!

After a year with not much movement in the forum I decided to close it.

The cost of maintaining the hosting is a bit high for the usage of the platform, updating the forum and managing it is also a bit cumbersome and the truth is that I'm already trying to maintain multiple other networks pretty more active than this forum.

I'll recommend you to move to the other raylib networks:

- For a forum style, use Reddit: https://www.reddit.com/r/raylib/
- For direct messaging and questions, use Discord: https://discord.gg/VkzNHUE
- To report issues, use GitHub: https://github.com/raysan5/raylib

- Also, remember you can contact me personally on Twitter: https://twitter.com/raysan5 or directly by mail to ray[at]raylib.com

If you feel generous, you can also contribute to the project on my Patreon: https://www.patreon.com/raylib

Thanks to you all for joining the project and help to improve it with your questions. Keep it up! :)

Best Regards,

Ray

PD. Closing will be effective by October 31th.

DrawTriangle() bug?

edited June 2016 in raylib: shapes
The triangle is not rendered iff (far as I can tell) the y value of the second vector argument is less than or equal to the y value of the first vector argument. This does not affect DrawTriangleLines() (so it seems like it might be a kink with the RL_TRIANGLES mode of rlBegin)

So, for example,

DrawTriangleLines(
(Vector2){100,100},
(Vector2){125, 25},
(Vector2){150, 100},
BLACK
);

works fine, but

DrawTriangle(
(Vector2){100,100},
(Vector2){125, 25},
(Vector2){150, 100},
BLACK
);

does not render anything visible. But

DrawTriangle(
(Vector2){125,25},
(Vector2){100, 100},
(Vector2){150, 100},
BLACK
);

does work fine.

Comments

  • edited June 2016
    Hey! Good catch! :D Actually, that's the expected behaviour for a triangle...

    Internally raylib enables backface-culling, it means not drawing faces that are not oriented towards the camera. Face orientation depends on face normal vector and it depends on vertex definition order.

    When you define the vertices following a counter-clockwise order, the normal of the triangle points towards the ortographic 2D camera and the triangle is visible; when you define them in clockwise order, the triangle is only visible from the other side of the window. This convention could be changed but the one used is pretty standard.

    Here it is some more info: http://stackoverflow.com/questions/15041517/what-is-a-clockwise-face-in-opengl

    For other shapes drawing, I take care of vertex definition order internally but in the case of DrawTriangle(), vertex are just defined in the order they are passed to the function.

    DrawTriangleLines() just draws line by line and this convention does not apply.
  • Ah, I see! Thank you for explaining!
Sign In or Register to comment.