S
S
Sasha2015-03-10 15:27:49
OpenGL
Sasha, 2015-03-10 15:27:49

How to make a window resize in OpenGL so that when the window is resized, the image does not scale?

When changing the height of the window, the picture is scaled to fit in the window
b7ebba43dd97450d8389c051fa8a0275.png6f8e22532a0741fba24c0a6594c74709.png
to set the scene using the following code

Gl.glViewport(0, 0, simpleOpenGlControl1.Width, simpleOpenGlControl1.Height);
            Gl.glMatrixMode(Gl.GL_PROJECTION);
            Gl.glLoadIdentity();
            Glu.gluPerspective(45.0f,
                (float)simpleOpenGlControl1.Width / (float)simpleOpenGlControl1.Height,
                0.1f, 100.0f);
            Gl.glMatrixMode(Gl.GL_MODELVIEW);
            Gl.glLoadIdentity();

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Makarov, 2015-04-03
@Nipheris

In general, you need to work with the projection matrix (you have gluPerspective) and glViewport. You can try to put constants at the viewport instead of the width and height of the control.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question