1
\$\begingroup\$

I currently have beginner knowledge of OpenGL and something doesn't go into my head! How do I create shapes like eg. a triangle with rounded borders. Or a quad with rounded borders. Or some random irregular shape. How is something like that done?

The only thing I could think of is creating an empty texture2D and editing the pixel data per CPU, but is that the way to go or are there better ways to do something like this?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

Well let's see, you either:

  • Have a texture that you made or downloaded, and supply it to the GPU
  • Generate a texture on the CPU and supply it to GPU for use in exactly the same was as above; generation can occur either before your program runs, or when it runs

  • Don't use textures; detail may be achieved by combining vertex colouring and geometry

Image generation is a whole separate field, which is why you do not see it in many games. The closest related fields in games are procedural generation and screen space / pixel shader effects (though modification that takes place here is not on the same order of complexity as generation).

is that the way to go

...for what? How can we answer if we don't know what you're trying to achieve? There are many reasons to use a generated texture, and more reasons not to, but we don't know which apply to you.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .