The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
triangles & aspects
speartip


Joined: 06 Feb 2017
Posts: 28
Hi,

I am endeavoring to put some simple triangles in my screen. The SDL wiki gives an example of - yes - connecting 3 drawlines. Am I overlooking something or do these lines have to be arrived at mathematically or hardcoded to know what anchoring coordinates they must belong to form the triangle. I don't see a function to make the triangle for you. This becomes rather labor intensive to create your triangle. Also once made, if your aspect ratio changes the lines of the triangle will have to be recalculated to maintain the equality of the angles. I can make a function to correct, no prob.

Before venturing out on some crazy triangle project, just wanted to know whether I was missing some piece of info.
speartip


Joined: 06 Feb 2017
Posts: 28
If anybody can point me to a guide containing a blurb/teach on triangles would appreciate it.
capehill


Joined: 13 Feb 2016
Posts: 18
How many triangles do you intend to draw? In 2D or 3D? If have a more ambituous project at hand, you may need to study some OpenGL. With SDL you can create an OpenGL context.

Check also SDL2_gfx project.

If you want to use basic SDL2 renderer features, you may need to create your own triangle function.