H
H
holywalley2016-10-14 00:47:08
OpenGL
holywalley, 2016-10-14 00:47:08

How to change GLOrtho during window redraw?

Hello. I am doing a course project, a solar system in c ++ and opengl.
I want to zoom in and out of the center of all coordinate axes. I'm trying to do this by decreasing the x and y values ​​in glortho. Since all my object coordinates are static, by decreasing the maximum value of the coordinate axis I get an approximation effect, but, unfortunately, by poking, I found out that reassigning glortho is possible only in two functions known to me, this is init, which is called only once at the beginning of the program, and reshape, which is called every time the window is resized. If you first reduce the values ​​of the variables, and then change the window size, then everything works, the objects are approaching, this indicates that everything else (perhaps, except for the idea) is correct for me.
So here's the question. How do I change glortho with every redraw?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly Stolyarov, 2016-10-14
@holywalley

First you need to switch to the GL_PROJECTION matrix, perform the transformation, and then back to GL_MODELVIEW

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question