A
A
Anthony2283572021-04-07 01:20:13
C++ / C#
Anthony228357, 2021-04-07 01:20:13

How to properly scale 2d objects in opengl?

Let's say I want to draw a square on the screen. If you use the standard orthographic projection, then with an aspect ratio of 1:1, the square will be a square, but when the window is stretched, it will be a rectangle. How to avoid it? Should I use a projection that can be measured in pixels to take a percentage of a side?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
Zakharov Alexander, 2021-04-07
@AlexZaharow

In my opinion, it's not about 2d, but just about the viewport. Most likely you need to "dig" in the direction of glOrtho . Example .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question