Even though I think the image is pretty self-explanatory, I'm going to explain what I am trying to achieve:
I was working on a game, and I needed a GUI framework, that I decided to build myself. As a first thing, I tried rendering a simple 2d quad with an orthographic projection. I was not satisfied with the boxy shapes windows had, so I tried fixing the problem by adding a texture; all this worked until I tried implementing resizing: whenever I changed the window size, the texture was warping, and it did not look good. Now I'm trying to use more than just two triangles, to smooth the corners of the windows. Now, my question is: how can I determine the number of triangles each window should have to have in order to obtain smoother corners? I would like to have some sort of "smooth" variable, that specifies how smooth(how many triangles are used) the window is. Thanks everyone for the help
EDIT:
I was thinking about this: do you guys think that generating the vertices of the window based on a condition in real time would be a good idea?
something like(proto code):
if(smooth == 1)
{
//define quad vertices
float vertices[] =
{
bla,bla,
bla,bla,
bla,bla....
}
}
if(smooth == 2)
{
float vertices[] =
{
bla,bla,
bla,bla,
bla,bla....
}
}
In a way, this would work, but I'm pretty sure there is a much better way to do this...
discard
or just using a simple texture as alpha mask in a 9-slice (which is much more flexible and easily skinnable without technical knowledge, or computional overhead). Use a distance field texture if you want to be fancy and feel like corners must be super, super round and perfect regardless of resolution. \$\endgroup\$